gpt4 book ai didi

javascript - 如何替换url中的哈希

转载 作者:搜寻专家 更新时间:2023-11-01 05:16:15 24 4
gpt4 key购买 nike

如何替换这样的 url

http://test.com/#part1

到:

http://test.com/part1

我知道 location.hash 但它会检测 url 中是否有哈希。

最佳答案

location.href = location.href.replace(location.hash,location.hash.substr(1))

关于javascript - 如何替换url中的哈希,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6950941/

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