Facebook给出“不安全的JavaScript尝试使用URL访问帧” Chrome中的错误 [英] Facebook gives "Unsafe JavaScript attempt to access frame with URL" error in Chrome

查看:121
本文介绍了Facebook给出“不安全的JavaScript尝试使用URL访问帧” Chrome中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的示例Facebook应用程序昨天在Chrome中运行良好。该页面通过JavaScript SDK集成了Silverlight广告Facebook。我可以检查基本的登录状态,登录到Facebook,获取您的姓名并注销。

My sample Facebook app was working great yesterday in Chrome. The page integrates Silverlight ad Facebook via the JavaScript SDK. I can check basic login status, login to Facebook, get your name and log out.

今天,我的部分没有更改,Chrome中出现了JavaScript错误这在Google搜索结果中很常见,但没有真正的答案。它在IE和Firefox中仍然很好用。

Today, with no changes on my part, it's broken in Chrome with a JavaScript error that's very common on Google search results, but no real answers. It still works great in IE and Firefox.

这是公共URL:

http://www.andrewdothay.net/prj/facebook/

当您在Chrome中打开JavaScript控制台时,会导致以下错误:

When you open the JavaScript console in Chrome, it throws tons of these errors:

不安全的JavaScript尝试访问框架与URL

Unsafe JavaScript attempt to access frame with URL

http:// www。 facebook.com/login.php?api_key=151352704876752&cancel_url=http%3A%2F%2Fstatic.ak.fbcdn.net%2Fconnect%2Fxd_proxy.php%23cb%3Df1175dd3f%26origin%3Dhttp%253A%252F%252Fwww.andrewdothay。净%252Ff304d89d8%26relation%3Dopener%26transport%3Dpostmessage%26frame%3Df3760623c%26result%3DxxRESULTTOKENxx&安培; channel_url = HTTP%3A%2F%2Fwww.andrewdothay.net%2Fprj%2Ffacebook%2F&安培;显示=弹出&安培; fbconnect = 1&安培;语言环境= EN_US&安培;方法= auth.login&安培;下一个HTTP =%3A%2F%2Fstatic.ak.fbcdn.net%2Fconnect%2Fxd_proxy.php%23CB%3Df3c546942%26origin%3Dhttp%253A%252F%252Fwww.andrewdothay.net%252Ff304d89d8% 26相关度%3Dopener%26transport%3Dpostmessage%26frame%3Df3760623c%26result%3DxxRESULTTOKENxx& return_session = 1& sdk = joey& session_version = 3& v = 1.0从URL http://www.andrewdothay.net/prj/facebook/

域,协议和端口必须匹配。

Domains, protocols and ports must match.

任何关于Chrome在这里发生了什么?

Any ideas on what's going on with Chrome here?

更新

发现Chrome在今天的机器上阻止登录弹出窗口,当我调用FB.login()时,但是我知道我昨天没有在JavaScript控制台中收到这190条错误消息。

I discovered that Chrome on today's machine was blocking the login pop-up when I was calling FB.login(), but I know I wasn't getting those 190 error messages in the JavaScript console yesterday.

所以,当我允许Chrome中的弹出窗口时,它对最终用户来说是有效的,但所有这些新的错误消息都会作为开发人员杀死我的诊断体验。

So, when I allow pop-ups in Chrome, it does work for an end user, but all those new error messages are killing my diagnostic experience as a developer.

推荐答案

我找到了解决方案。如果您在没有用户操作的情况下执行FB.login,则Webkit会阻止弹出窗口。

I've found the solution. If you execute FB.login without user action, webkit blocks the popups.

例如,我在我的项目中使用了一个邀请系统。有一个输入/文本输入邀请码。我查看了一个可用的ajax / post请求的邀请码。如果可用,我运行FB.login()。如你所知,浏览器阻止弹出窗口,并在js控制台出现大量错误。

For instance, I used an invite system on my project. There was a input/text to enter invitation code. I checked the invitation code is available with an ajax/post request. if it is available, I run FB.login(). As you guess, browser blocked popup and tons of errors appeared at js console.

所以你必须在用户操作后运行FB.login()。我将在ajax / post和FB.login()之间放置一个Facebook登录按钮。用户必须点击它 - 这很吸引人,但他们看不到问题。

So you must run FB.login() after a user action. I'll put a facebook login button between ajax/post and FB.login(). Users'll have to click it -thats sucks- but they'll not see a problem.

Btw,问题出现在几天之内。我认为这是关于浏览器的信任系统。当你开发它,你访问很多次,浏览器认为它是可靠的。我不知道这部分,但我的解决方案是有效的。

Btw, problem occures in a few days. I think it's about trust system of browser. When you're developing it, you visit lots of times, browser thinks it's reliable at first. I'm not sure about this part but my solution works.

这篇关于Facebook给出“不安全的JavaScript尝试使用URL访问帧” Chrome中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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