Question
Pegasystems Inc.
GB
Last activity: 29 May 2018 7:58 EDT
IAC / MashUp Javascript conflict in main document?
Hi there,
The IAC/MashUp is being included through a generated HTML snippet that
- includes some JS through a loading activity
- provides a DIV with parameters in which the MashUp iframe is being generated
Customer claims that the included JS on the top level document conflicts with one of their scripts, esp. the $ variable seems to be used from "both" sides. Following the trail of the loading activity, it indeed includes many JS files with a lot of code.
1) Is the observation correct that the Pega JS may collide with JS on the main document?
2) Is there a way to just include the iframe w/o any loading script?
Thanks!
Lars
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
IN
Hi,
Please share us pega version used ?
Thanks.
Greenfield Technology Aktiengesellschaft
DE
This is about Pega 7.3.1.
Greenfield Technology Aktiengesellschaft
DE
Hi Community,
Any updates on whether the mashup Java scripts in 7.3.1 collide with popular JS frameworks?
Cheers Lars
Pegasystems Inc.
IN
A web mashup requires a JavaScript file to be served in the host document. This JS provides all the mashup management functionality.
1. An activity "pzIncludeMashupScritps" is created. The mashup HTML snippet has a <script> tag whose src points to pzIncludeMashupScritps activity.
2. This activity reads the content of a Rule-File-Text "pzPega_webMashup.js" and returns the content to the client.
The webMashup JS looks in the DOM for DIVs with class="pega-mashup". For each such DIV, it creates an IFRAME element and appends it as a child to that DIV.
The src of the IFRAME is constructed from the attributes on the DIV.
(Further functionality e.g., resize logic will be added into this JS file)
Rules Involved
Rule-Obj-Activity "pzIncludeMashupScritps"
Rule-File-Text "pzPega_webMashup.js"
Rule-Obj-Activity "pzAddPortalLayouts"
1) Is the observation correct that the Pega JS may collide with JS on the main document?
Ans: which part of pzPega_webMashup.js your thinking that it’s colliding with other JS?
2) Is there a way to just include the iframe w/o any loading script?
Ans: I don’t think so we can achieve this requirement in Mashup right now .
Thanks,
Arun
Greenfield Technology Aktiengesellschaft
DE
Hi Arun,
Thanks for looking into the matter. Indeed, the mashup loading activity assembles like half a dozen JS files and the answer to the HTTP request has got a size of ~200kB JS code.
Customer claims that within his own (complex) web UI, the "$" variable gets modified by Pega mashup and the document loading event gets modified (not sure if this is body.onload()). Hence the customer refuses to include the mashup snippet and wants a clear separation of applications by embedding only an iframe w/o any script around it.
It is quite difficult to validate the statements as the JS code is obfuscated/compressed. Certainly, there is a "$(root)." fragment in the JS code and there is a "D.onload=function()" - whatever object "D" represents at this point at runtime...
So is it possible that the mashup JS interferes with other JS frameworks at certain points?
Cheers Lars
Pegasystems Inc.
IN
Can you let us know what you mean exactly by mashup scripts being interfered by other scripts in the host document. do customer use different jquery version compared to pega version ?
You can do one thing, instead of embedding the mashup script & snippet directly in the host document , have an iframe in the host document and embed mashup script & snippet in that iframe.
Greenfield Technology Aktiengesellschaft
DE
Thanks for the comment! Unfortunately, we already tried with an iframe inside an inframe and it does not work, the layout control gets lost. In addition, it creates more deployment/maintenance effort as the outer iframe have to come from some extra WAR. Hence this situation challenges the Pega position that mashup is an easy and recommended way to bring cases into other applications.
I cannot easily reproduce the error as I don't have access to the respective environment. Customer was given the snippet and replied in a bigger meeting rather angrily that the outer mashup JS interferes with their JS. Customer insisted that only a plain iframe snippet w/o outer JS would be acceptable. Changing code at the outer, consuming application is not possible either as this is kind of a "given product" as well.
So if the mashup actually uses JQuery and JQuery is a widely spread framework, what is Pega's plan to cope with version differences? In the "Java part" for example, Pega repackages public framework/helper JARs with a com.pega prefix for differentiating classes from class loaders perspective.
-
Oguz Cavli
Pegasystems Inc.
IN
In-order for mashup to load in the host page, it is required to have some pega bootstrapping JS loaded in the host document upfront which will do the job of parsing the host document for mashup snippets and accordingly rendering mashup gadgets (creating iframe etc...).
-
Maruti Phanigopal Donepudi