This time I will show you how to change the code of the current url without refreshing, and how to change the code of the current url without refreshing. What are the precautions?The following is a practical case, let’s take a look together take a look.
window.history.back();//Back
window.history.forward();//Forward
window.history.go(-1) ;//Move to the specified recording point, currently going backwards by 1, which is equivalent to window.history.forward()
window.history.length//You can know how many recording points there are in the history
The above is just a check Attached to the data
The following is about
history.pushState and history.replaceState
history.pushState will add a history record,
history.replaceState It will be replaced rather than added, so it will be more comfortable.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
Detailed explanation of H5’s storage method
How to use the constraint verification API in H5
postMessage implements cross-domain and cross-window messaging
The above is the detailed content of How to change the code of the current url without refreshing. For more information, please follow other related articles on the PHP Chinese website!