此网站如何更改浏览器的网址而不更改网页? [英] How does this site change the URL of the browser without changing pages?

查看:181
本文介绍了此网站如何更改浏览器的网址而不更改网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您在Google Chrome中访问 http://www.20thingsilearned.com/ 网站并更改页面,它会更改浏览器中显示的URL,但看起来并没有实际导航到另一个页面。



在Firefox中打开网站只使用普通的旧哈希URL。是什么让他们能够在Chrome中完成这项工作?

解决方案

他们使用新的HTML5 history.pushState() history.replaceState()方法


If you go to this site http://www.20thingsilearned.com/ in Google Chrome and change pages, it will change the URL displayed in the browser, but seemingly not actually navigate to another page.

Opening the site in Firefox just uses plain old hash URLs. What makes them able to do this in Chrome?

解决方案

They're using the new HTML5 history.pushState() and history.replaceState() methods.

这篇关于此网站如何更改浏览器的网址而不更改网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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