function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rafael Lessa BarretoRafael Lessa Barreto 

postmessage

I have a community using Build Your Own (LWR) and I have 2 Visualforce Pages loading in different IFrames on different Routes.
Everything works fine on the first opened route, but if I navigate for the other one I get this:
Uncaught TypeError: Illegal invocation
    at Object.patchedWindowPostMessageValue (lwr_bootstrap_locker:982:12)
    at Object.postMessage (lwr_bootstrap_locker:1058:20)
    at lwr_bootstrap_locker:6998:19
    at foreignErrorControlFn (eval at createConnector (lwr_bootstrap_locker:7236:12), <anonymous>:254:20)
    at BoundaryProxyHandler.applyTrap [as apply] (eval at createConnector (lwr_bootstrap_locker:7236:12), <anonymous>:790:34)
    at Proxy.loadTemplate (/programs/s/programs/modules/c/gfsPortalEmailTemplateIFrame.js:89:22)
This happens the code runs 
this.template.querySelector('iframe').contentWindow.postMessage('any message', '*')
I can't find a way to workaround this as it doesn't look to have an issue on Javascript, because the page that is visited first works. And when the second page fails, if I reload the page(reload button on browser) it works.
Anyone facing this problem?

 
SwethaSwetha (Salesforce Developers) 
HI Rafael,
Your ask seems similar to https://salesforce.stackexchange.com/questions/269627/iframe-in-salesforce-lightning-web-components. Does the solution listed help?

Thanks