Home > Web Front-end > H5 Tutorial > How to change the code of the current url without refreshing

How to change the code of the current url without refreshing

php中世界最好的语言
Release: 2018-03-26 14:46:17
Original
2026 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template