在我整合了Facebook Invite Friends插件后,第一次在任何浏览器中加载它,它运行正常,但是当我第二次尝试它(刷新之后)它就不再打开了。我一直点击但它没有打开。
这是代码:
function showPopup(pageURL, title, w, h) {
var left = (screen.width / 2) - (w / 2);
var top = (screen.height / 2) - (h / 2);
var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
}
window.fbAsyncInit = function () {
FB.init({
// appId : 'my app id', // App ID
// channelURL : '//WWW.mydomain.COM/domainfolder/channel.php', // Channel File
status: true,
// check login status
cookie: true,
// enable cookies to allow the server to access the session
oauth: true,
// enable OAuth 2.0
xfbml: true // parse XFBML
});
// Additional initialization code here
};
// Load the SDK asynchronously
(function (d) {
var js, id = 'facebook-jssdk';
if (d.getElementById(id)) {
return;
}
js = d.createElement('script');
js.id = id;
js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
//Replace the ALL_CAPS variables with your own values
function invite() {
FB.getLoginStatus(function (response) {
if (response.authResponse) {
// logged in and connected user, someone you know
FB.ui({
method: 'fbml.dialog',
width: '750px',
fbml: '<fb:request-form target="_self" method="post" invite="true" type="Invite" content="Hey! Come join me on this site! Finally it\'s opened for us! <fb:req-choice url=\'http://www.mysite.com/site/index.php\' label=\'Accept\' />" <fb:multi-friend-selector showborder="false" actiontext="Invite friends" email_invite="true" import_external_friends="true" /> </fb:request-form>'
});
} else {
// no user session available, someone you dont know
FB.login();
}
});
}
function loaded() {
document.getElementById('FBico').src = 'img/OtherServices/fb.png';
}
它在头标签中。清除历史后第一次完美运行。在Internet Explorer 9,Firefox 8,Chrome和iPad iOS 5中也是如此。
来自Facebook的 all.js 文件可能会在某处缓存而不会再次加载。只有一个只有/html/body/
代码/body//html/
的小文件,它始终可以正常运行。
如何阻止从Facebook缓存 all.js 文件?
答案 0 :(得分:0)