replaceState()vs pushState() [英] replaceState() vs pushState()

查看:109
本文介绍了replaceState()vs pushState()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读和寻找 replaceState()& pushState的()
另请阅读Mozilla的 article ,并且此 有趣强> 测试,但我仍然不清楚差异。



任何人都要小心解释他们的不同之处?

解决方案

replaceState()会改变浏览器中的网址(即按后面的按钮不会让你回来)
$ b preush preushState()将改变URL,并保持旧的一个在浏览器历史记录中(即按下后退按钮将带你回去)

I've been reading and searching for advantages / disadvantages between replaceState() & pushState(). Read also Mozilla's article, and this interesting test but still is unclear to me the differences.

Any one care to explain in what they differ?

解决方案

replaceState() will change the URL in the browser (ie. pressing the back button won't take you back)

pushState() will change the URL, and keep the old one in the browser history (ie. pressing the back button will take you back)

这篇关于replaceState()vs pushState()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆