I'm just wondering if it is possible to use the Facebook Javascript SDK and OAuth 2.0 in an Javascript bookmarklet, because I just can't get it to work. What I'm actually trying to do is to update my Facebook status through my bookmarklet, but it seems like FB.init does nothing. Also I don't get any failure responses.
Is it possible to do something like this or am I violating any sandboxes or so?
I'm using an jquery bookmarklet boilerplate which works great. When initializing the bookmarklet I append the sdk
var d = document,
js = d.createElement('script'),
root_node = d.createElement('div');
js.id = 'facebook-jssdk';
js.async = true;
js.src = "http://connect.facebook.net/en_US/all.js";
root_node.id = 'fb-root';
d.getElementsByTagName('body')[0].appendChild(root_node);
d.getElementsByTagName('head')[0].appendChild(js);
and then call fb.init
window.fbAsyncInit = function(){
console.log('JS-SDK loaded');
FB.init({
appId: 'XXX',
status: true,
cookie: true,
xfbml: true,
oauth: true
});
FB.getLoginStatus(function(response){
console.log(response);
});
};
Actually it looks like "console.log(response)" never gets called
Thanks, martin