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

[possible regression] window.history.replaceState fails in iframes and native webviews #7426

Closed
omryshap opened this issue May 26, 2019 · 8 comments
Labels
good first issue Easy to fix issues, good for newcomers

Comments

@omryshap
Copy link

Bug report

Describe the bug

As reported here (#3118, #3437, #5523), using next inside a iframe or native webview (android for example), fails on this error Error: Failed to execute 'replaceState' on 'History': A history state object with URL.

To Reproduce

create a webview in a native app, add src to a nextjs app, console will show the above error

Expected behavior

should not throw an error

Additional context

seems like this was handled in the past but either wasn't merged or somehow was removed from the codebase.

@omryshap omryshap changed the title [possible regression] window.history fails in iframes and native webviews [possible regression] window.history.replaceState fails in iframes and native webviews May 26, 2019
@timneutkens timneutkens added good first issue Easy to fix issues, good for newcomers help wanted labels May 27, 2019
@semoal
Copy link

semoal commented May 28, 2019

By the way, I only have this issue on exported html that i render on a iframe like this:

<iframe srcDoc={data.htmlReturned} />

data.htmlReturned is the html exported by the method app.renderToHtml() that comes from nextjs server side rendering. Also it has a base url that appends the url of the micro service that generates this html.

@timneutkens
Copy link
Member

Instead of posting "same issue" "ping" or similar use GitHub's reaction system and 👍 on the issue.

https://help.github.com/en/articles/about-conversations-on-github#reacting-to-ideas-in-comments

@smddzcy
Copy link

smddzcy commented Oct 29, 2019

I'm getting the same error while trying to render a Next.js app inside react-frame-component.

@DuudeXX8
Copy link

DuudeXX8 commented Mar 15, 2020

I'm not getting this error inside a iframe neither native webview.I get this when my page url end with two or more slashes. //.If I remove withRedux in this part of my code export default withRedux(makeStore)(MyApp); from _app.js file I get Internal Server Error in // this route.

Any help appreciated.

@marbiano
Copy link
Contributor

marbiano commented Jun 2, 2020

@smddzcy could you help me to build an example where this is failing? I put an example in here but it seems to be working fine. I also tried to add the app to a regular iframe as src and it's working fine too.

@omryshap is there any simple way to create a webview on a native app for a non-mobile developer like me? :)

@Timer Timer removed the help wanted label Jun 3, 2020
@nikhiltech
Copy link

We are facing same issue in MS word extension which is using IE11 underneath. Works well if the iframe is opened in chrome.

@jankaifer
Copy link
Contributor

I've tried reproducing this with next@13 and iframes work fine in chrome and firefox:
Iframe wrapper on codesandbox: https://codesandbox.io/s/admiring-villani-l7gtqg?file=/src/App.js

We are facing same issue in MS word extension which is using IE11 underneath. Works well if the iframe is opened in chrome.

We are not supporting IE: https://nextjs.org/docs/basic-features/supported-browsers-features

I'm not getting this error inside a iframe neither native webview.I get this when my page url end with two or more slashes. //.If I remove withRedux in this part of my code export default withRedux(makeStore)(MyApp); from _app.js file I get Internal Server Error in // this route.

I wasn't able to reproduce this.

I'll close this issue, but feel free to open a new one if you can reproduce this in a supported browser.

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Easy to fix issues, good for newcomers
Projects
None yet
Development

No branches or pull requests

10 participants