ghinda / jotted

Environment for showcasing HTML, CSS and JavaScript, with editable source.
https://ghinda.net/jotted/
MIT License
491 stars 36 forks source link

Prevent iframe top navigation #38

Closed patmood closed 7 years ago

patmood commented 7 years ago

Rendering a form in the "result" iframe will navigate to a new page when submitted.

I noticed a comment about using iframe sandbox attribute when IE9 is no longer supported. Is this an option?

I'm switching over from codepen that doesn't have this issue. I think it's because they use generous sandbox, but without allow-top-navigation.

There may be an IE9 solution using onbeforeunload too.

Great work on this project - Extremely high quality!

Happy to do a PR for this once a solution is decided

ghinda commented 7 years ago

I can't reproduce the issue you're having.

When using <form action="/"><button>submit</button></form>, the submit redirects only the iframe.

Maybe I'm missing something. Can you make a small demo on https://www.siloz.io/ (it uses jotted)?

patmood commented 7 years ago

You're right I can't reproduce. It must have been related to my code - my apologies!

I'll post with a demo next time

ghinda commented 7 years ago

No problem. Thanks for looking into it!