3 ms·
This is using the Ajax-era hash hack to change URL, which is causing problems with history and makes the reload button and favicon flash. I'd suggest using HTM
by mmahemoff 15y ago
This is using the Ajax-era hash hack to change URL, which is causing problems with history and makes the reload button and favicon flash.
I'd suggest using HTML5 history, specifically replaceState(). It works on all modern browsers. Works on IE10, but not IE9 and below. If you want to support IE, you could fall back to the current location.replace().
- jaip 15y agoI started with replaceState only, but later I realized there was no specific gain that I was having (other than slightly good looking string without hash). This method also suffers from reload and favicon flashes. If it reliably doesn't log to history (unlike location.replace()), using it could be a good idea. But that also comes with a tradeoff of older browser support issues, which requires using external javascript APIs.
- mmahemoff 15y agoI see. Surprised to learn there were still issues as replaceState() (as with pushState) is purely a transformation in the URL path. There's no reload and no update of the favicon link tag. Makes me wonder if that's a browser bug you saw.
- georgefox 15y agoWhat about detecting replaceState support and falling back to location.replace if necessary?