I want to update the URL using window.location.hash or history.pushState.
What are the differences and advantages of each method?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
location.hashhas a better support than thehistory.pushStatemethod.The advantage of the
pushStatemethod is that you can bind a state to the history entry.If you don’t need this state object, I recommend to use the
location.hashproperty, to have better compatibility with older browsers.