Home > Article > Web Front-end > HTML5 changes current url without refresh
This article mainly shares with you the HTML5 code for changing the current url without refreshing. Friends who need it can refer to it
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 understand How many record points are there in history?
The above are just incidental when checking information
Let’s talk about it
history.pushState and history.replaceState
history.pushState will add a history record,
history.replaceState will replace it without adding it, so it will be more comfortable.
The above is the detailed content of HTML5 changes current url without refresh. For more information, please follow other related articles on the PHP Chinese website!