【问题标题】:Facebook Web App development errorFacebook Web 应用程序开发错误
【发布时间】:2012-08-04 02:00:38
【问题描述】:

我在 chrome 上的调试控制台上不断收到以下错误

[blocked] The page at https://myURL/canvas ran insecure content from http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css.
[blocked] The page at https://URL/canvas ran insecure content from http://connect.facebook.net/en_US/all.js.
[blocked] The page at https://URL/canvas ran insecure content from http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js.

这些是附加到头部的js脚本

这是一个 facebook 应用程序,它向我自己的服务器发出 GET 请求,这工作正常,只是停止工作,我的代码没有任何变化!我不确定 Facebook 是否阻止了我的请求。

【问题讨论】:

    标签: javascript jquery facebook google-chrome


    【解决方案1】:

    当主页(在您的情况下是您的 Facebook 应用程序)通过 HTTPS 加载时,通过 HTTP 在其他域上加载脚本和其他外部资源(例如图像)时会发生这些错误。

    查看您应用的代码,在调用外部脚本时使用协议相关 URL。例如,而不是这个:

    <script src="http://connect.facebook.net/en_US/all.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css">
    

    这样做:

    <script src="//connect.facebook.net/en_US/all.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
    <link rel="stylesheet" type="text/css" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css">
    

    编辑:请注意,如果在样式表上使用协议相对 URL,IE7 和 IE8 将下载两次: http://paulirish.com/2010/the-protocol-relative-url/

    【讨论】:

    • 谢谢,这就是问题所在!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多