Home  >  Article  >  Web Front-end  >  HTML5 changes current url without refresh

HTML5 changes current url without refresh

怪我咯
怪我咯Original
2017-04-30 10:03:333514browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn