Home  >  Article  >  Web Front-end  >  Detailed example of teaching you how to use H5 to change the current URL without refreshing

Detailed example of teaching you how to use H5 to change the current URL without refreshing

Y2J
Y2JOriginal
2017-05-22 13:44:452966browse

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();//后退
window.history.forward();//前进
window.history.go(-1);//移动到指定记录点,当前倒退1,相当于window.history.forward()
window.history.length//可以了解历史中有多少个记录点

The above is just incidental when checking the information

The following is discussed

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.

【Related recommendations】

1. HTML5 free video tutorial

2. Detailed tutorial on operating the database through phonegap

3. Detailed explanation of how to use indexedDB database in H5

4. Why HTML5 is getting more and more advantages now

5. \9 and \0 may hack IE11\IE9\IE8 Detailed explanation of why it is invalid

The above is the detailed content of Detailed example of teaching you how to use H5 to change the current URL without refreshing. 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