我试图异步加载all.js文件。异步加载Facebook Javascript SDK
在我的ASCX文件:
<div id="fb-root"></div>
我有一个用户控件与包括JavaScript文件中:
window.fbAsyncInit = function() {
FB.init({
appId: 'XXXXXXXXXXXXX',
status: true,
cookie: true,
xfbml: true,
oauth: true
});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
然而,当页面呈现和负载,FB不存在。
什么给?