最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

html - How to avoid Chrome Console error Unsafe JavaScript? - Stack Overflow

programmeradmin2浏览0评论

Chrome display this error in console "Unsafe JavaScript attempt to access frame with URL https://domain1/app1/ from frame with URL https://domain2/app1/. Domains, protocols and ports must match."

Chrome display this error in console "Unsafe JavaScript attempt to access frame with URL https://domain1/app1/ from frame with URL https://domain2/app1/. Domains, protocols and ports must match."

Share Improve this question edited Feb 16, 2020 at 7:08 sideshowbarker 88.6k30 gold badges215 silver badges212 bronze badges asked Jan 17, 2011 at 12:17 mabuzermabuzer 6,7177 gold badges37 silver badges41 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 2

A frame cannot acces the content of another frame if it is not of the same origin. If that is what you're trying to achieve, you cannot work around that issue.

  • Same Origin policy

The browser will not allow Javascript to access cross domain, as malicious websites would be able to interact with other sites which would be a huge security concern.

I found this on Google groups, might be worth looking at:

I believe that dev versions of Chrome currently have support for Cross-Origin Resource Sharing, which allows hosts that want to to opt-into cross-origin XHR access http://dev.w3/2006/waf/access-control. You could try that, but it's pretty bleeding edge, so I'd expect rough patches.

发布评论

评论列表(0)

  1. 暂无评论