Facebook SDK window.fbAsyncInit 不在本地主机上触发?上周工作得很好。
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
console.log("hey");
// init the FB JS SDK
FB.init({
appId : '***************', // App ID from the App Dashboard
channelUrl : '//localhost/channel.html', // Channel File
status : true, // check the login status upon init?
cookie : true, // set sessions
xfbml : true // parse XFBML tags on this page?
});
}
// Load the SDK's 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 = "//connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js";
ref.parentNode.insertBefore(js, ref);
}(document, /*debug*/ true));
</script>
“嘿”在加载页面时不会触发
另外我注意到,当我在“Fb.init”中注释掉频道网址时,添加:
<script src="//connect.facebook.net/en_US/all.js"></script>
在文件的标题中,“嘿”在第一次加载页面时触发,但在后续尝试时不会触发
更明确地说。这是我控制台中的错误内容:
Uncaught SyntaxError: Unexpected token ( connect.facebook.net/en_US/all/debug.js:9237