[SOLVED] Iframe intercommunication. Launch vs Published

Greetings everyone,

iframe isn’t receiving messages from parent. This works fine from Launch/Debug but not when published.

The scene “0 - Published Showcase”, which is what was published. Works from Editor, but not when published at https://playcanvas.com/project/873970/overview/webxrpress-library

This is for my Open Source Metaverse project. One of the essentials is rendering a live console. I’m doing this with a template entity called “Billboard” that renders html assets in 3D space. There were several hurdles to do this; i.e. html2canvas was too slow, so I went with much faster Microsoft’s html-to-image, but rendering in the main thread was still causing controllers to freeze/hiccup, so I’m using an iframe to an external asset (basically a blank HTML page that includes jQuery to pipe in the HTML asset from playcanvas). I needed to do this multi-threaded and yet with access to a DOM for rendering. WebWorkers is too immature for this (no DOM) but since most modern browsers, including Oculus Quest’s native browser supports iframes in a separate thread; I get multi-threaded benefits with HTML DOM rendering recipes! But this only works in editor but not in published works.

Any ideas? This is opposite problem I was having prior; as I know there are security issues I’ve already overcome with XFrame in Editor mode (hence the external asset) but things were working in published before (or so I thought). iframe messaging is needed to pull this off; but I guess one work around could be a local websocket-to-websocket between iframes? If that is indeed the issue. But for the life of me, I can’t tell.

Turning this over to the experts that might be able to throw a hint to shed some light on this one. Any ideas greatly appreciated!

At a guess, are you iframing the published game into something or iframing something into your published game?

If the former, the publish link is actually iframing the PlayCanvas app. Add a /e before the /p in the link to get an iframeless version.

Eg https://playcanv.as/e/p/TMrb4ucs/

If the latter and the above doesn’t work, you may want to try self hosting or directly using the AWS S3 bucket URL for the app to that you will have to dig into devtools to find the redirect.

1 Like

Ahh yes that’s brilliant. Works right away. Thank you! The playcanvas script contains code that generates an iframe. Is there a setting for ‘/e’ option in the editor for the “Play” button on the project page? If not, no worries; I can mention it on the dev thread/description.


Unfortunately, no. It was originally there for the social bar at the bottom back when PlayCanvas was first made.

Noted. Thanks! I’ll consider this issue solved. Happy it works!