简体   繁体   中英

How to avoid Chrome Console error Unsafe JavaScript?

Chrome 在控制台中显示此错误“不安全的 JavaScript 尝试从 URL https://domain2/app1/ 的框架访问 URL https://domain1/app1/的框架。域、协议和端口必须匹配。”

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.

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.org/2006/waf/access-control . You could try that, but it's pretty bleeding edge, so I'd expect rough patches.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM