После того, как я интегрировал плагин Facebook Пригласить друзей, при первой загрузке в любом браузере он работает нормально, но когда я пробую его во второй раз (после обновления или чего-то еще), он просто больше не открывается.Я продолжаю нажимать, но он просто не открывается.
Это код:
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';
}
Он находится в теге head.Он отлично работает в первый раз после очистки истории.То же самое произошло в Internet Explorer 9, Firefox 8, Chrome и iPad iOS 5.
Файл all.js из Facebook может где-то кэшироваться и не загружаться снова.Есть один маленький файл с /html/body/
кодом /body//html/
, который работает все время безупречно.
Как я могу предотвратить кэширование файла all.js из Facebook?