I am creating a bookmarklet which inserts facebook's all.js in the page in the head
however it is not working without errors either, here it is:
javascript: (function() {
var msg = '';
if (typeof window.FB == 'object') {
msg = 'Already Facebookified';
} else {
var js = document.createElement('script');
js.id = 'facebook-jssdk';
js.async = true;
js.src = "http://connect.facebook.net/en_US/all.js";
document.getElementsByTagName('head')[0].appendChild(js);
msg = (typeof window.FB == 'object' ? 'Facebookified': 'Unable to Facebookify');
}
alert(msg);
})();
Can anyone suggest what could be wrong with it ?