Back button loses history push state changes when previously on page
Categories
(Core :: DOM: Navigation, defect, P3)
Tracking
()
People
(Reporter: bugzilla, Assigned: smaug)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36
Steps to reproduce:
- Start on a page that isn't the same as in step (2) - going directly to a URL in step 2 seems to stop the issue occurring. For example:
- Navigate to a page that modifies the URL using History PushState, by for example, searching "London". This will redirect you to:
https://www.openrent.co.uk/properties-to-rent/london?term=London
- Change the URL using push state, in this example, by using the advanced filter / changing rental amount. This will change the URL for example to:
-
Navigate to a new page, in this example, by clicking on a property
-
Click the browser back button
Actual results:
The browser supplies a request (according to the network tab), for the page with the modified URL. You can see it's redirecting to:
As you'd expect.
However, on load, calling window.location returns the original URL (not the modified or requested one), specifically in this example:
https://www.openrent.co.uk/properties-to-rent/london?term=London
Expected results:
On page load, calling window.location should return the modified / requested URL. Specifically in this example:
Comment 1•6 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
| Assignee | ||
Comment 2•6 years ago
|
||
I'll try to find time to investigate this some more.
OK great! Appreciate it's a bit of an odd one to reproduce, and apologies creating a minimal sample case was difficult in this instance.
Worth noting it's only Firefox that appears to exhibit this behaviour.
I've tried to create a minimal test case for you - but seem to be struggling to do so.
However, perhaps you could explain how the following happens (also see attached screenshot)
- Press back button on page, which does get request to correct URL
- HTML response has a script tag at the top to log the window location which shows a different URL
I am possibly missing something basic, but this seems like something that shouldn't be possible to me.
After a bit more investigation and debugging, it seems clicking "back" on the browser is triggering a second request, right after the first. Dev tools isn't showing this second request, and is only showing the first.
The second request appears to be to a different URL, and it's not clear why or where that URL is coming from.
This seems like quite a dramatic bug, but at the same time, I'm struggling to reproduce in a simple test case.
Any help appreciated.
I suspect this stack trace may be useful - otherwise, let me know if there is anything else I can supply to help investigate this.
It seems this has been fixed in Firefox 72.0.1, as I can no longer reproduce.
Would be good to confirm this was an intentional bug fix.
Thanks!
Updated•3 years ago
|
Description
•