日期:2014-05-17  浏览次数:20995 次

iframe 跨域问题 很是着急啊…
问题是这样的:
使用社交登录的插件,然后把插件的js放到一个login_social文件里面,iframe指向login_social,代码如下:
<div class="">您也可以使用以下帐号登录(测试版)</div>
<div id="social_login"></div>
<iframe id="myframe" src="login_social/" class="social"></iframe>


在Firefox下,登录都正常,但是Chrome下,会报下面的错误:

Unsafe JavaScript attempt to initiate navigation for frame with URL 'http://127.0.0.1/' from frame with URL 'https://openapi.baidu.com/social/oauth/2.0/receiver?code=7c6438e1797e5004fc…e. The frame attempting navigation is neither same-origin with the target, nor is it the target's parent or opener.


求各路大神来帮忙啊……

------解决方案--------------------
login_social/  后面把详细文件地址加上  或者吧url重写加上 试试
------解决方案--------------------
里面的JS会报错。。。说明里面的js有逻辑问题。。
单独进如页面去调试呗
------解决方案--------------------
跨域了,
可以在后台请求js然后再加载,
还有一种做法就是将127.0.0.1或localhost假映射为https://openapi.baidu.com/浏览器就不认为是跨域了