I\'m trying to update the URL using window.location.hash or history.pushState.
What are the differences and advantages of each method?
I agree with the other answers, but here are a few arguments in favor of location.hash:
edit: I forgot one
a href). So you don't have to set up click listeners, which improves performance and reduces code size.