【问题标题】:window.location.hash = '' doesn't remove the hash itself [duplicate]window.location.hash = '' 不会删除哈希本身 [重复]
【发布时间】:2012-12-05 16:11:06
【问题描述】:

可能重复:
How to remove the hash from window.location with JavaScript without page refresh?

当关闭幻灯片时,我不希望地址恢复正常,但“#”仍然存在,有什么办法可以解决这个问题吗?

【问题讨论】:

标签: javascript jquery hash


【解决方案1】:

来自https://developer.mozilla.org/en/DOM/window.location

例子

每当位置对象的属性被修改时,一个文档 将使用 URL 加载,就好像 window.location.assign() 已经 使用修改后的 URL 调用。

我认为这个问题解决了你想要使用 jQuery 的问题:

Change hash without reload in jQuery

其他相关问题:

Change the URL in the browser without loading the new page using JavaScript

How to remove the hash from window.location with JavaScript without page refresh?

How can I change Firefox window.location.hash without creating a page reload?

【讨论】:

    猜你喜欢
    • 2015-04-25
    • 2013-03-02
    • 1970-01-01
    • 2023-04-09
    • 2013-05-11
    • 2019-07-04
    • 2015-02-23
    • 1970-01-01
    • 2010-12-31
    相关资源
    最近更新 更多