I have a project where I'm trying to build an amp-story generator with a simple editor. You can check the current state at https://ampy.co/test/.
The idea is when you insert information on the left panel, the amp-story to be rebuild within an iframe element.
This works only in firefox, but fails in every other browser. Is there a way to achieve what I'm trying here?
Steps to reproduce:
- Open https://ampy.co/test/
- Open console (dev tools)
- Click add layer, or add page on the left panel
- Check the console log for all the errors such as "amp-story is already registered. The script tag for amp-story is likely included twice in the page."
Yes, the document is evaluated twice and hence the message. One possibility to resolve this is to replace the iframe entirely. For example, create a wrapper DIV:
And fill in your iframe when it gets updated: