Facebook应用程序 - 静默“协议必须匹配”错误 [英] Facebook app - Silent "Protocols must match" error

查看:194
本文介绍了Facebook应用程序 - 静默“协议必须匹配”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我当前的Facebook应用程序的登录流程(请参阅此答案进行说明)。 logout() login()是在用户注销或登录时呈现页面的虚拟函数。

Here is my current login flow for my Facebook app (see this answer for an explanation). logout() and login() are dummy functions that render the page when the user is logged out or logged in.

window.fbAsyncInit = function() { 
    FB.init({
        appId: '...',
        channelUrl: window.location.protocol + '//' + window.location.host + '/channel.html',
        status: false,
        cookie: true,
        xfbml: false,
        oauth: true
    });

    FB.getLoginStatus(function(response) {
        if (response.status === 'connected') {
            login(response);
        } else {
            FB.Event.subscribe('auth.login', function(response) {
                login(response);
            });
            logout();
        }
    });
};

使用此登录流程,当用户登录时,我不必重新加载页面,但是我得到无声的错误:

With this login flow, I don't have to reload the page when the user logs in, but I get the silent error:


阻止一个起始帧 http://www.facebook.com 从一个
框架起源 https://s-static.ak.facebook.com 。帧
请求访问具有协议http,被访问的帧
具有协议https。协议必须匹配。

Blocked a frame with origin "http://www.facebook.com" from accessing a frame with origin "https://s-static.ak.facebook.com". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "https". Protocols must match.

我认为重新加载页面将携带该应用的iframe转移到 https: / 协议,但我真的不明白为什么或什么意思。为什么会出现此错误,这是否值得关注?

I assume that reloading the page transfers the iframe holding the app to the https:// protocol, but I don't really understand why or what that means. Why is this error occurring, and is it something to be concerned about?

推荐答案

这是大多数浏览器的安全问题。你不能从http页面ajax一个https链接

This is a security issue in most browsers. You cant ajax an https link from a http page

可能的重复的 Facebook给出了不安全的JavaScript尝试使用URL访问帧 Chrome中的错误

这篇关于Facebook应用程序 - 静默“协议必须匹配”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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