Hacker News new | ask | show | jobs
by jaip 5157 days ago
I 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.
2 comments

I 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.
What about detecting replaceState support and falling back to location.replace if necessary?