Pages

Hacking Facebook with Javascript (Part1)


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:buddyList.toggleTab();

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 the same command again

Facebook Hack: Change facebook color
Check this out:

Isn’t that cool? Just use the following code to get your profile colour changed and impress your friends!
javascriptroundColor="red":void(document.
getElementById('headNavOut').style.backg);

Of course, you can use any color you like green, yellow, orange, black. It’s also fun to change it to “white” so you can’t see the text. Again, only you can see it, but it does last until you log out or view certain special pages.
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 “Douglas 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.

Instructions:
Find their ID from poke link or photos link or message link or *somewhere* on their profile
Make sure you're logged in to facebook
Make sure you're online on the chat widget
Add their ID to this JavaScript code:

javascript:buddyList.itemOnClick(FRIEND_­ID_GOES_HERE);

Paste that into the address bar, i.e. replace http://www.facebook.com/.... with the code
Press enter.
If the chat window pops up but says "Jimmy is offline" then facebook have cleared the history already. Sorry, it happens.

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

UPDATE2: Now that we have facebook usernames, it can be little harder to determine the ID of a profile, but it’s still possible – here’s one way: right click the “see all” friends link and choose “copy link location”, like so:

Or in Internet Explorer, you can choose “open link in new tab”. The resulting URL will look something like this:

http://www.facebook.com/friends/id=YOUR_ID_HERE
&view=everyone
That’s it!
Note:- The javascript should be in one line only (i.e continuous) pasted in the address bar.


More to come in Part 2...