Does someone have a running example of communication with an Iframe ?
I would love to take a look at it, cause i can’t get it to work.
Thanks in advance.
hi Dennis, i guess this is because of account limitations, with free account i tried it & had
Refused to display ‘https://launch.playcanvas.com/641048?debug=true’ in a frame because it set ‘X-Frame-Options’ to ‘deny’.
in the console. ( codepen test , & open console ), i just cant get the playcanvas in an iframe.
the manual page goes for people with upgrade account i guess too
I got this working with a few caveats:
Codepen: https://codepen.io/anon/pen/oPGQbp (click button in the top left of the page)
PlayCanvas project: https://playcanvas.com/project/575319/overview/communicate-with-iframe
- You have to use a published build (e.g https://playcanv.as/p/YhVutmbe/)
- You have to use the non iframe version of the published build (e.g https://playcanv.as/e/p/YhVutmbe/) Notice the extra
e in the URL.
The reason for this is that the normal published build link is wrapped in an iframe of its own so you end up with an iframe in iframe issue and therefore can’t post a message in the right window instance due to it crossing domains from CodePen to PlayCanvas.
e gives you un frame app so it can be embedded directly into a webpage and post messages without crossing domains.
I was making it way to complex.
Thanks for your straigth on answer. you solved it.
Many many thanks
It actualy works with a published project.
Please take a look at Yaustar anwer.
Anyhow, thanks for the help. You guys are awesome.
I connected the app with Ninjaforms in wordpress.
Works very good.