首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >历史pushState抛出隐秘的DOMException

历史pushState抛出隐秘的DOMException
EN

Stack Overflow用户
提问于 2019-12-27 10:28:28
回答 1查看 1.4K关注 0票数 0

因此,我使用的是历史API,我试图使用pushState()函数:

I did this: history.pushState({'a': 'b'}, 'Document', "index2.html");

它给了我这个错误:

Uncaught :未能在“历史”上执行“pushState”:具有URL‘.’的历史状态对象无法在原名为“null”和URL‘.

的文档中创建

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-12-27 10:35:59

是这个问题吗?replaceState() with document origin null

如果是这样的话,答案表明这是可行的:

代码语言:javascript
复制
history.replaceState(null,null, window.location.pathname + "your thing here");
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59499337

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档