Description
It seems like:
- Navigating from
/a
to/a
is treated like a reload (replaces history entry). - Navigating from
/a
to/a#foo
is a hash change navigation. - Navigating from
/a#foo
to/a
is a full navigation to/a
(adds a history entry).
However, replace should only happen if the initiator is same origin to the current document.
There's a non-interoperable case when it comes to redirects:
- Navigate to https://redirect-session-history.glitch.me/a - entry1
- Navigate to
/b
which redirects to/a
In this case Chrome & Safari will add a new history entry, whereas Firefox will replace the existing entry (or treat it like a reload, I'm not sure which).
I don't think it matters too much which behaviour we go with, but the Chrome/Safari behaviour seems simpler.
Firefox will switch to 'replace' even if part of the redirect is cross-origin, but I don't think that really matters in this case, because I'm pretty sure it's already observable.
@annevk @domenic @smaug---- this is the case we 'discovered' in the meeting.
Tests
Test:
- Navigate to https://redirect-session-history.glitch.me/a - entry1
- Navigate to
/a
Chrome, Firefox, Safari: replace doc in entry1
Test:
- Navigate to https://redirect-session-history.glitch.me/a - entry1
- Navigate to
/a#foo
- entry2 - Navigate to
/a
Chrome, Firefox: 3 history entries, first two share a document
Safari: 3 buggy history entries. Going back results in no doc change. Going back again results in no doc change, but also no hash change.
Test:
- Navigate to https://redirect-session-history.glitch.me/a - entry1
- Navigate to
/b
which redirects to/a
Chrome, Safari: 2 history entries, separate documents
Firefox: replace doc in entry1
Firefox will still replace if the redirect goes via another origin.
Test:
- Navigate to https://redirect-session-history.glitch.me/a - entry1
- Navigate to
/a#foo
- entry2 - Navigate to
/b
which redirects to/a
Chrome, Firefox: 3 history entries, first two share a document
Safari: 3 buggy history entries. Going back results in no doc change. Going back again results in no doc change, but also no hash change.
Test:
- Nav to https://redirect-session-history.glitch.me/a - entry1
- Nav to
/a#foo
- entry2 - Nav to
/b
which redirects to/a#hello
Chrome, Firefox: Entry 3 has a different doc to entries 1 and 2 (which continue to share a doc).
Safari: 3 buggy history entries. Going back results in no doc change. Going back again results in no doc change, but also no hash change.