javascript - Permission Denied Location.toString 发生在哪里

标签 javascript iframe widget

当我的应用程序嵌入到读取为

的 iframe 中时,我收到错误

Permission denied for https://myapp.com to call method Location.toString on http://otherhost.com

我没有得到任何浏览器中发生这种情况的堆栈跟踪、行号或文件。我怎样才能找出这个问题的根源?

最佳答案

发生此错误的原因是 same-origin policy 。您无法从跨域 iframe 内的非扩展源运行任何 Javascript。也就是说,Iframe 与主页的域不同。

关于javascript - Permission Denied Location.toString 发生在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3919722/

相关文章:

javascript - 我可以在JavaScript中使用closest()函数吗?

javascript - 无法将 appendChild 附加到从另一个框架创建的节点

php - .htaccess 重定向,除非在 iframe 中

javascript - 防止 Yahoo OpenID 重定向页面

ssl - 亚马逊小部件和 SSL

Javascript 打开关闭新消息

javascript - Alt-s Firefox 中的 Javascript 事件处理程序 : How?

javascript - php 多选下拉菜单

twitter - 嵌入式时间线的动态时间线选择-标签时间线

android - 单击小部件时播放声音