-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Should document.open() on an iframe really add history entries? #1484
Comments
Can you explain the problem in a bit more detail? document.open() in the general case (and when its "replace" boolean argument is not set to true) is basically meant to blow away the document and show new content. So having it create a new history entry makes sense to me. People will want to be able to press "back" to get the old document back. It's similar to navigation of an iframe in that way. When you navigate in an iframe, you have to click back more times, but that's not a bad thing. Or is this about the initial "about:blank" document? The spec already takes care of that though, saying that if the only session history entry is the about:blank document, it should be replaced regardless of the replace boolean. |
Sorry I'm just copying the context from the blink bug - take a look there and talk with japhet@ and @travisleithead. From my quick read it sounded like sites were doing programatic navigation of iframes which users did NOT expect to show up in their history. This seems consistent with @ojanvafai's argument that back/forward should only navigate to history entries created in response to a user gesture. But if we're changing our back/forward behavior and UI treatment (and NOT the information exposed via the history API) then perhaps this isn't actually a spec issue at all but a product UI issue? |
If other browsers are interested in making the change, I think we're happy to change the spec; document.open() is such a ... bad thing ... anyway, so I don't particularly plan to fight for an interpretation of what it's supposed to do. However, I think it is slightly user-hostile to not create a history entry when someone uses this DOM-level-0 method of "navigating" to a new page. (I think of document.open() as kind of a DOM-level-0 mashup of I'm curious whether Gecko and Edge are interested in changing. I guess @travisleithead might be because of the compat problems they're experiencing? @smaug----, thoughts? |
What is that? Are we trying to kill also pushState? Or is this just an UI thing?
Well, pages are doing programmatic navigations all the time, either via .location or via document.open() etc. And pages are also using history.go() in very unexpected ways, leading to surprising bugs. (like the somewhat recent Google Ads bug where its scripts where doing history.go(-1) leading to top level navigation to previous page.) One thing to remember here is that blink is broken also in other ways when dealing with document.open(), like, it doesn't create a new Window object. I don't yet have an opinion on this issue. It is possible that I've got used to the weirdness of document.open. |
Per offline discussion with japhet@, we'll keep the spec as-is. There's still a lot of Blink work to do on aligning document.open() with the spec, but that's kind of separate. And similarly there's a separate question about mitigating the addition of history entries that are not tied to a user gesture. |
The spec seems to imply that a history entry should be added when opening an iframe. Edge and Firefox do this, but Chrome doesn't (blink bug). Changing blink to match the spec looks like it will result in a worse user experience (having to click back more often on some sites). Should we change the spec instead?
Test page.
Note that I don't know much about history myself, just moving this issue from blink to the spec where it belongs. Blink's history expert is japhet@chromium.org but I don't see a GitHub account for him. /cc @domenic @majido.
This is also related to a larger class of issues: WICG/interventions#21
The text was updated successfully, but these errors were encountered: