李恒道 发表于 2021-8-28 22:18:23

marqqer 发表于 2021-8-28 21:56
收回这个贴,这样改了还是不行,刚才不知道为什么devtool能看到newhistory,重启浏览器后发现还是有问题 ...
按道理不应该呀...哥哥论坛发一下你脚本我调试看看?
你发的那个脚本地址我没match上那个地址

marqqer 发表于 2021-8-28 23:15:22

李恒道 发表于 2021-8-28 22:18
按道理不应该呀...哥哥论坛发一下你脚本我调试看看?
你发的那个脚本地址我没match上那个地址



现在可以了,我刚才写错了 调用unsafeWindow.newhistory未成功
改成
try {
        if (unsafeWindow.history.pushState){
          unsafeWindow.history.pushState(null, curTitle, url);
        }else if (window.newhistory.pushState){
          window.newhistory.pushState(null, curTitle, url);
        }
} catch (e) {
          console.error('添加下一页到历史记录失败', e);
}
可行,而且发现这时 window.history.pushState(null, curTitle, url);也可成功执行,现在在研究 unsafeWindow是怎么绑定函数的,看能不能绑定是检测,避免绑定网站的history函数
如果需要调试:




marqqer 发表于 2021-8-28 23:26:42

李恒道 发表于 2021-8-28 22:18
按道理不应该呀...哥哥论坛发一下你脚本我调试看看?
你发的那个脚本地址我没match上那个地址



刚才这个脚本require locllhost resources
用这个调试:




李恒道 发表于 2021-8-28 23:39:33

marqqer 发表于 2021-8-28 23:15
现在可以了,我刚才写错了 调用unsafeWindow.newhistory未成功
改成



哥哥能解决就行,哥哥牛逼!
页: 1 2 [3]
查看完整版本: 网站定义了一个history()函数,导致脚本中无法访问Window.histor...