I made this simple bookmarklet to get the Facebook id from a Facebook user's profile.
var fb_idsource=document.getElementById("pro开发者_StackOverflowfile_action_send_message").href;
var fb_userid=fb_idsource.match(/\d+/g);
alert(fb_userid);
Open someone's facebook profile with a send "Message" button at top right corner. It will work if you paste it and run via Google Chrome developer console, but not working when used as bookmarklet by adding "javascript: " prefix.
Any ideas how to make it work?? Thx for any advice.
Drag and drop this into your bookmark bar, works great!
http://jsfiddle.net/wesbos/Evzek/
<a href='javascript:(function(){var fb_idsource=document.getElementById("profile_action_send_message").href; var fb_userid=fb_idsource.match(/\d+/g); alert(fb_userid);})();'>Get ID</a>
Ps great idea - will use this for sure!
精彩评论