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

Mar 26, 2018 pm 02:46 PM
Change

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!

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to change the starting delivery price of Meituan Takeout merchant version How to change the starting delivery price of Meituan Takeout merchant version Mar 27, 2024 pm 07:20 PM

How to change the starting delivery price of Meituan Takeout merchant version

How to change border color on Win7 computer How to change border color on Win7 computer Jul 17, 2023 am 08:53 AM

How to change border color on Win7 computer

How to change the icon size in win11 How to change the icon size in win11 Jul 04, 2023 pm 03:57 PM

How to change the icon size in win11

Control element visibility using jQuery Control element visibility using jQuery Feb 20, 2024 am 10:25 AM

Control element visibility using jQuery

How to change the save location of win10 recording How to change the save location of win10 recording Jul 22, 2023 pm 08:05 PM

How to change the save location of win10 recording

Tesla app store debuts: revolutionary change in driving experience Tesla app store debuts: revolutionary change in driving experience Jun 29, 2023 pm 02:24 PM

Tesla app store debuts: revolutionary change in driving experience

How to change the default c drive to d drive in win7 How to change the default c drive to d drive in win7 Detailed introduction How to change the default c drive to d drive in win7 How to change the default c drive to d drive in win7 Detailed introduction Jul 12, 2023 pm 07:09 PM

How to change the default c drive to d drive in win7 How to change the default c drive to d drive in win7 Detailed introduction

New changes in PHP8: exploring its impact on change New changes in PHP8: exploring its impact on change Jan 13, 2024 am 08:47 AM

New changes in PHP8: exploring its impact on change

See all articles