当前位置:网站首页>Jump without refresh - detailed explanation of pushstate and replacestate methods in history
Jump without refresh - detailed explanation of pushstate and replacestate methods in history
2022-06-11 02:05:00 【Bejpse】
〝 The ancients lost their knowledge , Kung Fu begins when you are young and when you are old 〞
** About history in pushState and replaceState Methods, ,** Often codewords are not easy , It's more difficult to produce high-quality products , Not particularly lucky , Then please make special efforts first , Don't fail because of laziness , And hypocritically attributed the reason to his bad luck . You have to work very hard , To appear effortless . If this article can help you a little , Hope to give little brother flying rabbit one key three times , Express support , Thank you guys .
Catalog
3、 ... and 、 The two are the same
Four 、 Differences between the two
One 、 Method function
- HTML5 The new interface , You can change the URL without refreshing the page
- There are cross-domain problems , Rewriting to another domain name is not supported
- Just change the URL , Web pages don't really jump , And you won't get new content , In essence, the web page still stays on the original page

Two 、 Parameters,
- window.history.pushState( data, title, url )
- data State object : Information to the destination route , May be empty
- title The page title : Currently, all browsers don't support , Fill in the blank string
- url Optional url: The goal is url, Will not check url Whether there is , And not across domains . If you don't pass on the item , Give the current url add to data

- window.history.replaceState( data, title, url )
- data State object : Information to the destination route , May be empty
- title The page title : Currently, all browsers don't support , Fill in the blank string
- url Optional url: The goal is url, Will not check url Whether there is , And not across domains . If you don't pass on the item , Give the current url add to data
- Be similar to pushState, But it will replace the current url, Not in history Leave a record in the book

3、 ... and 、 The two are the same
- Can be modified without refresh url
- Does not support cross domain , That is, it does not support the modification of records into other domain names
- For example, I am under Baidu domain name , I want to c Put the domain name of the station into the history

Four 、 Differences between the two
- Whether the record will be left , The meaning of this sentence is to change url after , Is it ok to pass back retracement
- pushState Because leave a record , So you can go back
- replaceState Because there is no record left , So you can't return


边栏推荐
- 中国各省份省会的坐标
- 2021-07-18 ROS notes - basics and communication
- Win11触摸键盘主题如何更换?Win11更换触摸键盘主题的方法
- 關於概率統計中的排列組合
- AI 狂想|来这场大会,一起盘盘 AI 的新工具!
- Coordinates of the capital of each province in China
- Task01: array
- Deep exploration of functions with indefinite parameters in C language
- [leetcode] ordered linked list transformation binary search tree
- ACM tutorial - heap sorting
猜你喜欢
![[music] playing](/img/cf/63b04080867e93ab2e00e2e21b37df.jpg)
[music] playing "over fire" based on MATLAB [including Matlab source code 1875]

关于CS-3120舵机使用过程中感觉反应慢的问题

【音乐】基于matlab演奏《天空之城》【含Matlab源码 1874期】

薪的测试开发程序员们,你为何要走?和产品相互残杀到天昏地暗......

(solved) latex -- cancel the superscript display of references in the text (gbt7714-2015 will lead to the default superscript reference) (tutorial on mixed use of superscript and flush)
![[leetcode] restore binary search tree](/img/92/14c4d670f318f93297040241a61c41.jpg)
[leetcode] restore binary search tree

Dinner a bang's Craft

flutter_ Swiper carousel map plug-in

Interviewer: let me introduce the items in your resume. Tell me more about them, and attach the actual project

视频压缩数据集TVD
随机推荐
Win11画图工具没了怎么重新安装
Xpath注入
[leetcode] same tree + symmetric binary tree
Dialog alertdialog, simpledialog, showmodalbottomsheet, showtoast shutter custom dialog
【音乐】基于matlab演奏《过火》【含Matlab源码 1875期】
[matlab] image enhancement (power transformation, histogram specification processing method, smoothing and sharpening filtering)
[matlab] image compression coding (DCT, RLE)
Start with interpreting the code automatically generated by BDC, and explain the trial version of the program components of sapgui
Kubernetes binary installation (v1.20.15) (VII) plug a work node
数据库概述
ACM教程 - 堆排序
Virtual joystick of QT quick QML instance
How to reinstall win11 drawing tool when it is missing
Within one month, the broadcasting volume has increased by 9million, and station B has three traffic growth passwords!
[traitement d'image] système multifonctionnel de traitement d'image basé sur l'interface graphique MATLAB [y compris le code source MATLAB 1876]
Loki 学习总结(1)—— Loki 中小项目日志系统的不二之选
Basic underlying principles of concurrent programming (4)
C语言 深度探究具有不定参数的函数
Method of using dism command to backup driver in win11 system
Task07: double pointer