Hacking Facebook with Javascript

June 10, 2009 at 2:36 pm (Uncategorized)

Because facebook relies so heavily on javascript, and because we can type javascript into the address bar, that means we can “poke” into the workings of facebook to do things that we wouldn’t normally be able to do. It’s not “hacking” exactly, but it employs the same sort of skills hackers use when looking into applications. The best part is that because it’s all using the same control codes (or “API”) that facebook uses, there’s no way for facebook to find out you’re doing it, so it’s totally safe! (I think…) Besides, we’re not going to be doing anything too dodgy, just a few little tweaks ;)

Facebook Hack: Sending your friends offline

Here’s a funny one; if you’re chatting to a friend, get them to paste the following code into their facebook address bar:

javascript:statusControl.sendVisibility(false);

It’ll make them go offline! Of course it’s not permanent, they can go back online by clicking the icon as normal, or by giving this command:

javascript:statusControl.sendVisibility(true);

Facebook Hack: Change profile colour

Check this out:

Isn’t that cool? Just use the following code to get your profile colour changed and impress your friends!

javascript:void(document.getElementById('fb_menubar').style.background='red');

Of course, you can use any colour you like; green, yellow,orange, black. It’s also fun to change it to “white” so you can’t see the text. Muahahaha. Again, only you can see it, and it only lasts till you refresh the page, but it’s still worth it!

Facebook Hack: Get Chat History Even When Friends Aren’t Online

Here’s a facebook hack that’s actually proven very useful to me in the past. One thing that I find annoying about facebook is that you can’t retrieve chat history if your buddy is offline… well now you can! :)

Click onto your friend’s profile page and copy their facebook ID from the address bar; i.e. the number after “id=”, highlighted in red below:

It might look slightly different,  perhaps like this: http://www.facebook.com/home.php#/profile.php?id=123132132213&ref=nf

But the important thing is to copy the number of the user, in our case 123132132213

Then while you’re still on facebook, type this into the address bar:

javascript:buddyList.itemOnClick(123132132213);

(with the correct ID of course)

And their chat window will pop up, saying “Jimbo is offline”. And if there’s any chat history, it will be displayed. How neat is that!

You can even open a chat window to yourself by pasting your own ID into the javascript, as seen to the right. You can use it for little notes to yourself, but remember that facebook chat history is cleared every few days, so don’t rely on it.

UPDATE: a few people have had trouble pasting it in correctly, so here’s how it should look:

Facebook Hack: Change your name (temporarily)

This one’s a very simple hack that you can apply to any website. As you saw in the screenshot above, I’d changed my facebook to display as “Facebook | Leet Hax0r”. You can do this by using the following javascript:

javascript:void(document.title="Facebook | Neo");

Sadly, your friends will only see your actual name, not the new one, but it can make for some amusement in a computer lab class or anywhere where you can show people face to face.

Facebook Hack: Close chat windows

If you’re chatting to a friend and want to close the window, sure you can just click the ‘x’ in the top corner, but isn’t it cooler to do it with javascript? Well no not really, but if you can trick your friend into typing the following code in, you can close the chat window of anyone they’re chatting to:

javascript:chatDisplay.tabs[123132132213].tabXOnClick();

That will close my chat with “123132132213″. You can send your friends that link with your own facebook ID in it, and it’ll close their chat window with you! And if you happen to know that ID:123 is chatting with ID:321, you can send the following to ID:123, and when they paste it in it’ll close their chat with 321!

javascript:chatDisplay.tabs[321].tabXOnClick();

Other Facebook Hacks

The hacks above are the most impressive, but there are a few other little things you can do which are mildly interesting:

Bring up notifications:

javascript:presence.toggleTab('chat_status_control','chat_status_control_tab');

Bring up online friends list:

javascript:buddyList.toggleTab();

Bring up application tab:

javascript:applicationDock.toggleTab();

Make text bold or underlined in facebook chat: use *stars* for bold text, and _underscores_ forunderlined. There is no way to get italic text on facebook; see my comment here about facebook chat italics.

That’s all the hacks I’ve found (but I know there are more). In fact, it’s possible to get your friends to “like”, or “unlike” items, and I think it would be possible to get them to comment and more, but the complexity of the javascript makes it not worth doing, plus you have to get them to paste code into their address bar – there’s no way to do it without getting them to do that.

Facebook Easter Egg: Pirate Language

Here’s a nice little facebook easter egg for you:  Go to the language settings page and scroll to the bottom of the list of languages, and somewhere around there you should see “English (Pirate)” in the list of supported languages.

Choose that language option and avast ye sails fer much facebook silliness.

Facebook Easter Egg: Konami

This one is awesome, thanks to Jim in the comments for letting me know about it.

Click in your status update box and type the following: [up] [up] [down] [down] [left] [right] [left] [right] b a [enter], and then click anywhere on the page to see lensflares:

Facebook Chat Smilies

There are a whole load of facebook emoticons available in the chat window. Here’s the complete list decribing what facebook smileys there are and how to display smilies in facebook chat. This seems to have been first discovered by 20bits.com.

facebook happy smiley :) facebook sad smiley :( facebook tongue smiley :P facebook grin smiley :D
facebook shock smiley :o facebook wink smiley ;) facebook glasses smiley 8) facebook cool smiley 8|
facebook grumpy smiley >:( facebook erm smiley :/ facebook crying smiley :’( facebook devil smiley 3:)
facebook angel smiley O:) facebook kiss smiley :* facebook love smiley <3 facebook happy smiley ^_^
facebook happy smiley -_- facebook confused smiley o.O facebook laugh smiley <:o facebook pacman smiley :v
facebook shark smiley (^^^) facebook cat smiley :3 facebook robot smiley :|] facebook putnam smiley :putnam:

I hope you enjoyed that post, please thumb me up on stumbleupon or digg me if you liked it :)Happy Hacking! If you want to learn how to hack, I also have a little hacking tutorial online that you might enjoy.

About these ads

1 Comment

  1. Joe Black said,

    good stuff

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: