這裏是我的情況:我有一個Javascript插件,當點擊時在啓動它的第三方網站上彈出一個彈出窗口。 popop然後顯示一個IFRAME,其中我使用Facebook作爲登錄方法。不安全的JavaScript嘗試訪問框架...協議必須匹配
當彈出啓動時,它最近開始給了一個錯誤:
Unsafe JavaScript attempt to access frame with URL http://{THIRD-PARTY-SITE-GOES-HERE} from frame with URL https://s-static.ak.facebook.com/connect/xd_arbiter.php?version=18#channel= …%3Dtabmodule%26utm_term%3D200000%26fb_xd_fragment%23xd_sig%3Df2ade8e518%26.
The frame requesting access has a protocol of 'https', the frame being accessed has a protocol of 'http'. Protocols must match.
的IFRAME本身是HTTPS和用於正常工作。我不確定Chrome爲什麼要訪問父頁面。我無法控制父頁面,所以我不能讓它們成爲https。
這裏是我的FB初始化代碼從IFRAME內:
window.fbAsyncInit = function()
{
FB.init({
appId: '{myappid}',
status: true,
cookie: true,
xfbml: true,
oauth: true,
channelURL : 'https://degree3.com/channel.php'
});
FB.getLoginStatus(function(response)
{
if (resp = response.authResponse)
{
$('#fb_button').attr("onclick", "signinViaFacebook(response.authResponse.userID, response.authResponse.accessToken);").show();
}
});
};
(function()
{
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
任何想法如何,我可以修復這個錯誤?
_「IFRAME本身在https上_」 - 錯誤消息似乎表明否則。 – CBroe 2013-02-13 00:21:57
@CBroe對不起,如果我不是更清楚:由於某種原因的錯誤信息是指父頁(第三方網站去這裏),而不是IFRAME本身。 iframe由我控制,並位於https上。 – Wemmick 2013-02-13 04:40:40
關於欺騙:[不安全的JavaScript嘗試訪問URL的框架](http://stackoverflow.com/q/4324108/1456376):看起來沒有關係到我。他們所有的網頁都在同一個域名上,而Facebook沒有涉及。 [不安全的JavaScript嘗試訪問帶有URL的框架...「錯誤在Chrome Webkit檢查器中不斷生成](http://stackoverflow.com/questions/3010170/unsafe-javascript-attempt-to-access-frame-with-url-error - 持續):也不完全一樣:我的錯誤不是連續的,它阻止了Facebook JS SDK的正常操作。 – Wemmick 2013-02-13 04:44:54