Facebook身份验证 - 不安全的JavaScript尝试使用URL访问框架 [英] Facebook Authentication - Unsafe JavaScript attempt to access frame with URL

查看:393
本文介绍了Facebook身份验证 - 不安全的JavaScript尝试使用URL访问框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



尽管尝试连接到Facebook,但我从控制台日志中收到错误:

 不安全的JavaScript尝试使用URL访问框架https://s-static.ak.fbcdn.net/connect/xd_proxy.php?xxxxxxxxxxxxxxxx 

我正在使用JavaScript SDK



我添加了这在 body 标签中:

 < div id =fb -root>< / DIV> 
< script>
window.fbAsyncInit = function(){
FB.init({
appId:'xxxxxxxxxxxxxx',
status:true,
cookie:true,
xfbml:true
});
};
(function(d){
var js,id ='facebook-jssdk'; if(d.getElementById(id)){return;}
js = d.createElement('script '); js.id = id; js.async = true;
js.src =//connect.facebook.net/en_US/all.js;
d.getElementsByTagName('head' )[0] .appendChild(js);
}(document));
< / script>

Facebook登录按钮:

 < div class =fb-login-buttondata-perms =email>使用Facebook登录< / div> 

我正在从本地主机测试 - 我已经在facebook开发应用程序注册我的网站(网站URL: http:// localhost



如何解决这个问题?或者我应该使用PHP SDK?



编辑:当我上传到具有公共域的服务器时也是同样的问题。

解决方案

您在那里看到的错误是非致命错误。没有解决方法,因为您的浏览器建议您从外部域加载JavaScript不是一个好主意。如果您的脚本不运行,请忽略此消息并在其他位置查找错误。 Sajith也是正确的,你不能从本地主机调试。



另请参见
不安全的JavaScript尝试使用URL访问帧在Chrome Webkit检查器中不断生成错误


I am trying to implement Facebook Login System into my website.

While it try to connect to facebook, I get an error from console log:

Unsafe JavaScript attempt to access frame with URL https://s-static.ak.fbcdn.net/connect/xd_proxy.php?xxxxxxxxxxxxxxxx

I am using JavaScript SDK

I added this in the body tag:

<div id="fb-root"></div>
<script>
    window.fbAsyncInit = function() {
        FB.init({
            appId      : 'xxxxxxxxxxxxxx',
            status     : true, 
            cookie     : true,
            xfbml      : true
        });
    };
    (function(d){
        var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
        js = d.createElement('script'); js.id = id; js.async = true;
        js.src = "//connect.facebook.net/en_US/all.js";
        d.getElementsByTagName('head')[0].appendChild(js);
    }(document));
    </script>

Facebook Login button:

<div class="fb-login-button"  data-perms="email">Login with Facebook</div>

I am testing from localhost - I have register my website on facebook develop apps (Site URL: http://localhost)

How to fix this problem? or should I use PHP SDK?

Edit: Same problem when I uploaded to server with public domain.

解决方案

The error that you see there is a non-fatal error. There is no workaround for this, as your browser is advising you that it is not a great idea to load JavaScript from foreign domains. Just ignore this message and look elsewhere for bugs if your scripts do not run. Sajith is also correct that you can't debug from localhost.

See here also, "Unsafe JavaScript attempt to access frame with URL..." error being continuously generated in Chrome webkit inspector

这篇关于Facebook身份验证 - 不安全的JavaScript尝试使用URL访问框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆