我一直在阅读和寻找 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()
发布评论