Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Uncaugh DOMException: Failed to execute 'postMessage' on Window

SA-105781

Summary



Pega Platform 7.1.8 is upgraded to Pega Platform 8.3.1.

Error occurs when using Pega 8.3.1 Mashup to embed Pega applications to a custom portal. The Getgadgetdata Pega Mashup API is used while closing a tab.

For more information, refer to: (https://community.pega.com/knowledgebase/articles/pega-web-mashup/pega-web-mashup-page-javascript-actions#getgadgetdata)



Error Messages



Uncaught DOMException: Failed to execute 'postMessage' on 'Window': Invalid target origin '//IAC' in a call to 'postMessage'.
    at Object.D [as send] (https://mtkdapt.mediatek.inc/prweb/IAC/s6z5yZ_AcLWppACxZyTSqQ%28%28*/!STANDARD?host=bpmdev8&pzuiactionzzz=CXtpbn1GUXVIQmxCNndHdkVKVGlaa3dFVjU2czJOdi96RjlpeFV3WU0zcTVIOTRvSE1EQ05nRWovMUhMcVdsejJ3SVhy*:71:798)
    at J (https://mtkdapt.mediatek.inc/prweb/IAC/s6z5yZ_AcLWppACxZyTSqQ%28%28*/!STANDARD?host=bpmdev8&pzuiactionzzz=CXtpbn1GUXVIQmxCNndHdkVKVGlaa3dFVjU2czJOdi96RjlpeFV3WU0zcTVIOTRvSE1EQ05nRWovMUhMcVdsejJ3SVhy*:71:1517)
    at Object.H [as send] (https://mtkdapt.mediatek.inc/prweb/IAC/s6z5yZ_AcLWppACxZyTSqQ%28%28*/!STANDARD?host=bpmdev8&pzuiactionzzz=CXtpbn1GUXVIQmxCNndHdkVKVGlaa3dFVjU2czJOdi96RjlpeFV3WU0zcTVIOTRvSE1EQ05nRWovMUhMcVdsejJ3SVhy*:71:2846)
    at pega.web.gadget._postActionToGadget (https://mtkdapt.mediatek.inc/prweb/IAC/s6z5yZ_AcLWppACxZyTSqQ%28%28*/!STANDARD?host=bpmdev8&pzuiactionzzz=CXtpbn1GUXVIQmxCNndHdkVKVGlaa3dFVjU2czJOdi96RjlpeFV3WU0zcTVIOTRvSE1EQ05nRWovMUhMcVdsejJ3SVhy*:68:20378)
    at pega.web.gadget._doApiAction (https://mtkdapt.mediatek.inc/prweb/IAC/s6z5yZ_AcLWppACxZyTSqQ%28%28*/!STANDARD?host=bpmdev8&pzuiactionzzz=CXtpbn1GUXVIQmxCNndHdkVKVGlaa3dFVjU2czJOdi96RjlpeFV3WU0zcTVIOTRvSE1EQ05nRWovMUhMcVdsejJ3SVhy*:68:20871)
    at pega.web.apiSingleton.doAction (https://mtkdapt.mediatek.inc/prweb/IAC/s6z5yZ_AcLWppACxZyTSqQ%28%28*/!STANDARD?host=bpmdev8&pzuiactionzzz=CXtpbn1GUXVIQmxCNndHdkVKVGlaa3dFVjU2czJOdi96RjlpeFV3WU0zcTVIOTRvSE1EQ05nRWovMUhMcVdsejJ3SVhy*:68:3564)
    at eval (eval at mtek.bpm.unloader.releaseLock (https://mtkdapt.mediatek.inc/portal/iac/static/js/bpmBridge_p8.js?1584506732131:53:2), <anonymous>:1:14)
    at Object.mtek.bpm.unloader.releaseLock (https://mtkdapt.mediatek.inc/portal/iac/static/js/bpmBridge_p8.js?1584506732131:53:2)
    at J.<anonymous> (https://webrs.mediatek.inc/wf/dev/WFPortal/build/ewfportal.js?1584506681230:3758:54)
    at h.Event.fire (https://webrs.mediatek.inc/wf/dev/Extjs/3.2.1/ext-all.js?1584506681228:7:22475)



Steps to Reproduce

  1. Include the Mashup code used in a JSP file as below:

    <script src ='/prweb/IAC/?host=<%=host%>&pyActivity=pzIncludeMashupScripts'></script>
    <div id="IACGadget"
    data-pega-gadgetname ='IACGadget' 
    data-pega-action ='OpenWorkByURL' 
    data-pega-action-param-query='[email protected]'
    data-pega-action-param-model ='' 
    data-pega-action-param-readonly ='false'
    data-pega-isdeferloaded ='false' 
    data-pega-applicationname ='MTKBPMApp' 
    data-pega-threadname ='<%=threadId%>' 
    data-pega-resizetype ='stretch' 
    data-pega-url ='/prweb/IAC/' 
    data-pega-action-param-parameters ="{'pzSkinName':'MTEKApplicationSkin','pyMashupSkeletonName':'pyDefaultMashupSkeleton'"></div>

     
  2. Reference a custom JavaScript file in the JSP file.
  3. Use the code as below to obtain the Gadget data in the JavaScript file:

    pega.web.api.doAction("IACGadget", "getGadgetData", "[pyWorkPage.pzInsKey]")


Root Cause



For DOMException, in the Mashup snippet, the 'data-pega-url' attribute is specified as '/prweb/IAC/', which resulted in the error.

For more information, refer to: https://community.pega.com/knowledgebase/articles/pega-web-mashup/pega-web-mashup-page-javascript-actions#getgadgetdata.

Square brackets must be included if Data Binding (as below) is used.


pega.web.api.doAction("myGadget", "getGadgetData", "[gadget/myGadget/.pxCreateOpName]")

This must be referred as pega.web.api.doAction("myGadget", "getGadgetData", "[.pxCreateOpName]")

Data Binding syntax:

[page/id/elementName]

[page/name/elementName]

[page/function/token]

[gadget/gadgetName/property]



Resolution



Here’s the explanation for the reported behavior:

For DOMException, in the Mashup snippet, specify the complete URL (including the domain name) for the 'data-pega-url' attribute.

Use the below syntax when the doAction(getGadgetData) is undefined:

Pega.web.api.doAction(:IACGadget”,”getGadgetData”,”pyWorkPage.pzInsKey”,{callback:function(){debugger;alert(‘calling back…’); debugger;}})
Suggest Edit

Published August 6, 2020 - Updated December 2, 2021

Did you find this content helpful? Yes No

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us