gpt4 book ai didi

javascript - 如何在不刷新页面的情况下更改 URL?

转载 作者:行者123 更新时间:2023-12-05 00:55:34 24 4
gpt4 key购买 nike

一些网站如 https://featurepoints.com正在使用一种技术,在这种技术中,用户无需任何刷新即可打开新页面,URL 将被更改,但没有刷新或 ajax 使用。他们使用什么技术?是pushState吗?

最佳答案

我想你可能正在寻找 history.pushState

history.pushState([data], [title], [URL]);

以您的 https://featurepoints.com/ 为例

history.pushState(null, 'FeaturePoints Login', 'https://featurepoints.com/login');

来源和更多细节https://css-tricks.com/using-the-html5-history-api/

关于javascript - 如何在不刷新页面的情况下更改 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64012293/

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