I\'m trying to update the URL using window.location.hash or history.pushState.
What are the differences and advantages of each method?
Currently, pushState is supported by all modern browsers. Therefore pushState is better than location.hash, but it is a HTML5 feature.
So, location.hash is not dead, in fact it will be around for a long, long time.
A good way to use this is with a lib that supports pushState, but also gracefully degrades to using location.hash.
Example - https://github.com/browserstate/history.js
Moreover location.hash will still be useful for jumping to named anchors.
pushState will be a tremendous help in building web apps. I look forward to using it.