gpt4 book ai didi

html - 更改 URL 而不刷新?

转载 作者:太空宇宙 更新时间:2023-11-04 13:36:23 25 4
gpt4 key购买 nike

我在互联网上找到了一个应用程序,当你点击一个链接时,它会重定向到一个页面,而不刷新整个地方和更改 url 地址栏,我知道它可能是因为 JQuery 可以访问客户端 sode 浏览器.

帮我解决这个问题。

最佳答案

使用 history api 你可以做这样的事情

  if (history && history.pushState){
history.pushState(null, null, '/new/url');
}

现在在浏览器中使用 chrome js 控制台试试吧

这就是它所需要的(也许更多一点,但这是它的基础

阅读更多 http://diveintohtml5.info/history.html

关于html - 更改 URL 而不刷新?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17166523/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com