2 ms·
This pushes my buttons indeed. But I also ran across some sites messing with the history, so they take you to a different site when you click "back". I am esp
by danuker 5y ago
This pushes my buttons indeed.
But I also ran across some sites messing with the history, so they take you to a different site when you click "back".
I am especially worried about pushState and replaceState.
https://developer.mozilla.org/en-US/docs/Web/API/History_API#browser_compatibility https://developer.mozilla.org/en-US/docs/Web/API/History_API...
- bee_rider 5y agoWait, can any webdevs explain a legitimate use for these features? Because my (admittedly uninformed) mind can only think of bad uses...
- throwthere 5y agoRouting in single-page applications relies heavily on the history API I think.
- devinmcafee 5y agoThat's correct. When navigating around in a single page app, clicking on an in-app link won't trigger the browser to make a new HTTP GET to fetch an HTML response from the server. Instead, the routing system will use the pushState API to push a new entry into the history and update the DOM to match the new route. By using pushState, your client side JavaScript can replicate native browser behavior and preserve function of the back button to get to previous routes in the application.
- titzer 5y agoIs it just me or has Youtube screwed something up here? About 1/3rd chance that the back button doesn't do anything on the last Youtube page in Safari.