Lisäsin nettisivustolleni Facebookin suosittele-painikkeen. Painike toimii, JOS EI ole sisäänkirjautunut Facebookiin millään tunnuksella. Jos on, käy niin, että popup-ikkuna, josta kirjaudutaan Facebookiin, ponnahtaa auki sivulla ja sulkeutuu saman tien loputtomiin nopeaan tahtiin. Missä voi olla vika? Seuraavassa on koodi, jonka lisäsin sivulle.
window.fbAsyncInit = function() {
FB.init({appId: '1234567890', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol
'//connect.facebook.net/fi_FI/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
window.fbAsyncInit = function() {
FB.init({appId: '1234567890', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol
'//connect.facebook.net/fi_FI/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
Vastaukset 2
Vanhimmat
window.fbAsyncInit = function() {
FB.init({appId: '1234567890', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol
'//connect.facebook.net/fi_FI/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"
html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="http://www.facebook.com/2008/fbml"
head
/head
body
!-- Facebookin suosittele-nappi --
fb:like href="http://www.osoite.fi/" action="recommend" font="arial"
/fb:like
-- Facebookin JavaScript SDK --
div id="fb-root"
/div
script
window.fbAsyncInit = function() {
FB.init({appId: '1234567890', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol
'//connect.facebook.net/fi_FI/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
/script
/body
/html