Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird behaviour with Firefox's back-button #20

Open
mtlehtin opened this issue Jan 13, 2020 · 2 comments
Open

Weird behaviour with Firefox's back-button #20

mtlehtin opened this issue Jan 13, 2020 · 2 comments

Comments

@mtlehtin
Copy link

When clicking the back-button in Firefox, the browser will replace the url and content of the iframe with the parent's url and content. Issue can be easily reproduced in vue-friendly-iframe's documentation and demo -site.

Issue exists at least with Firefox 68.3.0, 70, 72.0.1.

Steps to reproduce:

Screenshot:

Screenshot 2020-01-13 at 8 28 53

Discussion elsewhere:

https://stackoverflow.com/questions/5259154/firefox-back-button-vs-iframes
https://stackoverflow.com/questions/2245883/browser-back-acts-on-nested-iframe-before-the-page-itself-is-there-a-way-to-av

@mtlehtin
Copy link
Author

mtlehtin commented Jan 13, 2020

The issue seems to be related with historyApi. When the iframe's URL is applied by window.location.href it changes the history stack and causes the issue. When the URL is applied by window.location.replace without affecting the history the back-button works as intended.

This change seems the fix this issue. I'm not sure if there are any harmful side-effects with that solution.

https://github.com/officert/vue-friendly-iframe/blob/master/src/components/FriendlyIframe/index.vue#L69

<body onload="window.location.replace('${this.src}'); parent.postMessage('${this.iframeLoadedMessage}', '*')"></body>

buksy90 pushed a commit to buksy90/vue-friendly-iframe that referenced this issue May 4, 2020
@buksy90
Copy link

buksy90 commented May 4, 2020

I experience same issue and created PR based on the suggested solution #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants