我是 JavaScript 新手,我正在开发一个网站,当我点击网站的某些元素而不重新加载页面时,我希望能够切换 URL。
我希望它像 http://www.itemcycle.com 一样工作当您单击链接出售您的 iPad 或 iPhone,然后选择您的型号时。它显示不同的框,当您单击它们时,它会更改 URL,但我知道它没有加载新页面,因为它不会将我滚动回顶部。
在此先感谢您的帮助!
最佳答案
您看到的是单页应用程序
A single-page application (SPA), also known as single-page interface (SPI), is a web application or web site that fits on a single web page with the goal of providing a more fluid user experience akin to a desktop application.
这将通过使用某些 JS 框架来实现。 AngularJS 是流行的一种。
关于javascript - 如何使用 JavaScript 更改页面 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37181242/