Skip to content

Which location should reload on history.go(0)? #2436

@asajeffrey

Description

@asajeffrey

The spec for history.go() at https://html.spec.whatwg.org/multipage/browsers.html#dom-history-go says:

When the go(delta) method is invoked, if delta is zero, the user agent must act as if the location.reload() method was called instead.

This is ambiguous as to which location should be used, the one for the window whose history is being accessed, or the current document. Unfortunately, different browsers behave differently, as shown by:

<html>
  <body>
    <iframe id="child"></iframe>
  </body>
  <script>
    var child = document.getElementById("child");
    setTimeout(function () { console.log("Finished."); }, 1000);
    child.contentWindow.history.go(0);
  </script>
</html>

Under FF, this will loop forever reloading (because the main document is reloaded) whereas in Chrome it will terminate (because the child is reloaded).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions