Я пытаюсь запустить первый пример из документации JS SDK. Я создал новое приложение, создал пустой документ под названием "facebookTest.html", вставленный в код из примера и подключенный к новому App App ID. Код выглядит следующим образом:
<html>
<head>
<title>Login with facebook</title>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'my app ID', // App ID from the App Dashboard
status : true, // check the login status upon init?
cookie : true, // set sessions cookies to allow your server to access the session?
xfbml : true // parse XFBML tags on this page?
});
// Additional initialization code such as adding Event Listeners goes here
};
// Load the SDK source Asynchronously
// Note that the debug version is being actively developed and might
// contain some type checks that are overly strict.
// Please report such bugs using the bugs tool.
(function(d, debug){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = document.location.protocol+"//connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js";
ref.parentNode.insertBefore(js, ref);
}(document, /*debug*/ false));
</script>
Когда я загружаю страницу, на консоли Javascript появляется следующее сообщение об ошибке:
Failed to load resource
Что я делаю неправильно?
EDIT: Когда я добавляю document.location.protocol
перед "//connect.facebook.net/..."
, как предложено здесь, экран остается пустым, а консоль показывает следующее:
GET file://connect.facebook.net/en_US/all.js
Это все, что должен делать этот код? Или он все еще не работает?