【问题标题】:Disable history api in firefox/chrome在 firefox/chrome 中禁用历史 API
【发布时间】:2013-05-15 16:07:15
【问题描述】:

我想在 Firefox 中禁用历史 API,因此 history.js 将使用带有哈希的回退机制。这样可以避免使用 IE 来测试/开发回退功能。

谢谢

【问题讨论】:

  • window.history = null; delete window.history; ?
  • 这个属性好像是不可移除的。在您的代码之后,该属性仍然存在。
  • 其实不要做delete window.history部分
  • 这段代码还是改变了url:delete window.history; window.history.pushState({}, "title", "/newpath");
  • 我说不要包含delete window.history;部分。 执行window.history = null;...然后尝试访问window.historyhistory

标签: javascript google-chrome firefox history.js


【解决方案1】:

伊恩,对不起。我误会你了。是的,设置为 null 是有效的。现在的问题是,history.js 进行了自己的测试来确定历史 API 的可用性。我发现模拟哈希回退的唯一方法是修补历史库:Force History.js to use hash URL fallback

【讨论】:

    猜你喜欢
    • 2012-01-04
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    • 2014-11-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多