Hacking Facebook

Wersja Polska

Hacking Facebook with Javascript

now updated for the latest (March 2010) version of facebook!

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:


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!


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, but it does last until you log out or view certain special pages.

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

New: Video Tutorial for this hack.

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:


(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.

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:


That’s it!

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:


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!


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:


Bring up online friends list:


Bring up application tab:


Make text bold or underlined in facebook chat: use *stars* for bold text, and _underscores_ for underlined. 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. This list includes the shark smilie and the new facebook penguin smiley!

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.



Related Posts:

, , , , , ,

  1. #1 by mini on November 24, 2009 - 6:42 am

    why is it not working for me? do i just need to paste the javescript ( javascript:void(document.getElementById(’presence_ui’).style.background=’red’) ) in the toolbar?

    nothing is happening when I’m pasting the java script in the toolbar. please help.

    • #2 by Saifee on February 5, 2010 - 11:59 am

      i also tried it bt nothing happens :(

  2. #3 by Jizzle on November 24, 2009 - 9:20 am

    Ok you need to use this code:
    msking sure you include the semicolon ( ; ) at the end as your code doesn’t seem to have one and you replace the facebook URL with this code and then hit enter. You can also change the colour red to any colour you like. Black, Green and Navy are probably the better ones.

  3. #4 by elmerfudddied on November 24, 2009 - 6:02 pm

    I came across this site while trying to figure out how get my own hack working…if you right click on the chat list (the part that looks like this| chat(18) | ) and then click on “view background image” it sends you here:


    This image makes me think that the smileys are taken from a tile set, and that by tweaking some JavaScript, it may be possible to send a smiley that is in a different part of the image.

    is there any way to listen to the page to see what it is executing, or do I have to trace through the source code to see what does what?

    • #5 by user24 on November 25, 2009 - 1:43 am

      You’re absolutely correct, the smileys are taken from a “tile set” known as a “css sprite” – well done on finding the actual image they use!

      However, you won’t be able send “special smilies” because the person you’re sending them to would need to have your special javascript too.

      The javascript listener you’re talking about is something that would be *really* useful, and I’m sure it must exist, but I haven’t found it yet. You might look into modifying the prototype of “function”….

      • #6 by elmerfudddied on November 30, 2009 - 9:04 am

        There is one thing that bugs me about the tile set though. This image has smileys, but not all of them. It is missing the penguin, shark, robot, and putnam ones. I found that the penguin appears here
        why would they use a tile set for some, but not others?

        • #7 by user24 on November 30, 2009 - 9:48 am

          Yeah I know. My guess is that facebook engineers have added the penguin, shark and putnam and hacked it in some other way. I notice that every time a new smiley gets added, a new comment appears on all the facebook smiley blogs telling everyone about it. I am certain that these comments are from facebook guys getting the word out virally.

  4. #8 by mido dahroug on November 26, 2009 - 2:27 am


  5. #9 by Carrie on November 28, 2009 - 12:15 pm

    can you undelete a deleted message?

    • #10 by user24 on November 30, 2009 - 9:49 am

      not that I know of, sorry.

  6. #11 by jurix on November 29, 2009 - 6:09 am

    thx, good to know.
    Could anyone help: is it possible to open multiple chatwindows with the javascript:buddyList.itemOnClick(…) comand. I mean it is possible to see the chat history of two, or more friends (two or more ID numbers)? Because it would be very useful to have one command to display the chat history of a group of friends…
    Thanks for the answer

  7. #12 by elmerfudddied on December 2, 2009 - 8:54 am

    Btw, the color hack that’s currently posted only changes part of the banner. If you replace ‘fb_menubar’ with ‘menubar_container’, it will color the whole banner. You can replace it with ‘content’ to change the background of the page.
    The easiest way to find more element names is to use the firebug plugin, or chrome’s “inspect element” feature.

    here are the codes for what I just described:

  8. #13 by D on December 4, 2009 - 7:10 pm

    I’m trying to find the chat history put when i cut & paste the number nothing happens!! what am i doing wrong?

  9. #14 by Custopootimus on December 4, 2009 - 8:02 pm

    Here’s a thing I put on facebook for the benefit of my friends, and I hope it can help all of you out as well:

    The following codes should be copy+pasted into your browser’s address bar.

    –Changing Colors–

    The Menu Bar

    If you are interested in modifying the above codes for different colors or to work on any other page, copy and paste the link address into your browser bar and replace the color with any of the following:
    aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow.



    –Changing Background Image–

    Menu Bar

    Chat Bar

    –The God Hack–
    javascript: document.body.contentEditable = ‘true’; document.designMode = ‘on’; void 0

    Another piece of code I wrote for use on http://wikipediagame.org/ This one should be entered into the address bar after going to the ‘starting’ page. Simply type the name of the destination in the prompt and you will be taken to it faster than anyone else!
    javascript:pvar=prompt(“Desination”),uvar=pvar.replace(” “,”_”),void(document.getElementById(‘wiki’).src= ‘/wiki/’+uvar);

  10. #15 by wonderer on December 5, 2009 - 7:06 am

    does anyone know how to put a background image for facebook…………………
    it will be usefull to make it beautiful

  11. #16 by s on December 13, 2009 - 10:00 am

    Here’s a little addition to make life easier. Make a bookmark to this:


    Now to open a chat box click the bookmark and type your friends code number.

    • #17 by Howard Yeend on January 26, 2010 - 3:23 pm

      the same, more compactly:


  12. #18 by coolman on December 15, 2009 - 2:02 am

    here is a problem. its about geting the Chat History Even When Friends Aren’t Online. There r some frnds of mine which doesnt hav a facebook ID from the address bar. for example its like zat… http://www.facebook.com/sarpires?ref=ts!!! there is no ID. Wat to do? Is there any way I can get the ID?

  13. #19 by joery on December 15, 2009 - 8:01 am

    it is possible to retrieve previous chat even we have clear the chat history?

  14. #20 by coolman on December 15, 2009 - 5:19 pm

    its ok now… I hadnt watch the video clip! :P

  15. #21 by AKhza on December 24, 2009 - 6:05 pm

    waw, its good job

  16. #22 by sports cars on December 27, 2009 - 12:27 am

    woo gitu ya caranya. Thanks mas ….

  17. #23 by Pranay on December 27, 2009 - 1:27 am

    i didnt get the full chat history.just about half.is there a way to retrieve the full history ?

    • #24 by user24 on December 28, 2009 - 11:46 am

      no, AFAIK fb delete it completely after a while.

  18. #25 by Jonny on December 27, 2009 - 6:42 pm

    Ok this may sound like a simple request to you, but a while back when playing one of the war apps, someone created a ‘war list’. this basically had all the enemies ‘links and automatically updated itself with whether they were online, dead, in hospital etc. Is there a template anywhere for this or suggestions on how to build one that i can modify with different links as neccessary. Thnx in advance :)

    • #26 by user24 on December 28, 2009 - 11:45 am

      I have absolutely no idea what you’re talking about.

  19. #27 by kabz on January 2, 2010 - 9:44 pm

    heyyy how do u get the i.d 4 da person 2 get in2 chat history??? am lost????

  20. #28 by kayla on January 5, 2010 - 3:22 pm

    hi, i tried the command to open chat & works fine with profiles with ID numbers but how about those with profile names?

    err, how does it work after that?
    it still shows the person’s name & no ID.
    can sumbody pls help? thanks!

  21. #29 by silvi on January 12, 2010 - 11:30 am

    silvi qahi

  22. #30 by Ben on January 13, 2010 - 3:14 am

    Is there a way to get someone elses facebook password.. well i need it ASAP.. Having problem wit me misses!!!

  23. #31 by tia on January 13, 2010 - 2:52 pm

    how do i hack into sumones fb with out there emal and password??

  24. #32 by petris on January 14, 2010 - 8:24 am

    yuuu hu

  25. #33 by jojo on January 16, 2010 - 1:47 pm

    Hello can you tell me if there is a way to see someones photos if their profile is private. thanks

  26. #34 by coldwar on January 16, 2010 - 2:57 pm

    how can you delete somebody only from chat,that he or she can not see you ???

  27. #35 by Sara Ali on January 17, 2010 - 7:10 am


  28. #36 by Duden on January 18, 2010 - 5:00 pm

    Thank you for the chat history hack, really useful!

  29. #37 by ahm on January 19, 2010 - 8:26 pm

    can i retrieve chat history after i delete my friends on my friends list?

  30. #38 by steffie on January 19, 2010 - 11:10 pm

    I am trying to view my chat history but it comes up and says could not retrieve chat history and its really really really really important. PLEASE HELP

    • #39 by user24 on January 20, 2010 - 2:02 pm

      Sry if facebook have already deleted it then you can’t get it back.

  31. #40 by denesae on January 23, 2010 - 9:37 am

    I want to hack a friens face book and look at there chat history noy mine

  32. #41 by SK on January 25, 2010 - 10:40 pm


  33. #42 by fleccy on January 29, 2010 - 9:59 am

    you can make yourself in your own family with a bit of messing about in firebug ;)

  34. #43 by val on January 31, 2010 - 11:14 pm

    the lens flare did not work. i tried actually typing out all the words [up] [down] with the brackets exactly like u put, no luck. i also tried just hitting the keys in the correct order, no luck. ??

  35. #44 by arocks on February 6, 2010 - 3:13 am

    Hahahaha. Cool pirate language

  36. #45 by john on February 6, 2010 - 9:21 am

    hey thanks for the codes and can you get the chat bar a diffrent color thanks if you can

  37. #46 by some kind of guy on February 10, 2010 - 8:25 am

    It does not work on the new facebook

    • #47 by Howard Yeend on February 11, 2010 - 1:21 am

      yes it does. checked this morning.

  38. #48 by Need to know.. on February 11, 2010 - 4:17 am


    Im trying to get the full chat history of my bf with his friend, it confirms he was cheating, and he literally chatted abt 2 min before i tried the following, but it was a long chat and cant see all of it. Pls please PLEASE tell me theres a way to retrieve the inital info…

    i used htis : javascript:buddyList.itemOnClick(561264257);

  39. #49 by rohit on February 13, 2010 - 10:01 am

    Jizzle :
    Ok you need to use this code:
    msking sure you include the semicolon ( ; ) at the end as your code
    doesn’t seem to have one and you replace the facebook URL with this
    code and then hit enter. You can also change the colour red to any
    colour you like. Black, Green and Navy are probably the better ones.

    petris :
    yuuu hu

    Need to know.. :
    Im trying to get the full chat history of my bf with his friend, it
    confirms he was cheating, and he literally chatted abt 2 min before i
    tried the following, but it was a long chat and cant see all of it. Pls
    please PLEASE tell me theres a way to retrieve the inital info…
    i used htis : javascript:buddyList.itemOnClick(561264257);

    Need to know.. :
    Im trying to get the full chat history of my bf with his friend, it
    confirms he was cheating, and he literally chatted abt 2 min before i
    tried the following, but it was a long chat and cant see all of it. Pls
    please PLEASE tell me theres a way to retrieve the inital info…
    i used htis : javascript:buddyList.itemOnClick(561264257);

  40. #50 by Nikhil gahlot on February 13, 2010 - 10:28 pm

    i want to hack a facebook id.

  41. #51 by Kurta on February 14, 2010 - 6:59 am

    Facebook disabled my pages’ publishing rights after sending me a link to authorize my page. How do i enable them again? is there a javascript for this?

  42. #52 by netherkate on February 14, 2010 - 12:39 pm

    Hi I want to hack a facebook password i know the email address and the id?

  43. #53 by Amanda on February 17, 2010 - 5:44 am

    I followed the exact steps for retrieving facebook chat history as directed. first I tried on safari and on firefox from my macbook with javascript enabled. Are there settings on my facebook account I need to change as well or has facebook disabled this ability?

    My second questions is do I need to be “online” to chat in order to perform history retrieval?

    When I do as you say to do, when the person is online, the chat window pops up but no history and when they are offline the chat window pops up saying “john doe is offline” without history too.

    • #54 by Amanda on February 17, 2010 - 6:19 am

      ps I was right clicking the poke button and copying link location and then taking the ID out of it. I think thats what u said to do…

  44. #55 by facebook account hack on February 18, 2010 - 2:33 pm

    Hey there , thanks for that very usefull tricks .
    that tab color trick
    please how can i make it always appear ? can i do this ?
    thank u again

  45. #56 by hannah on February 21, 2010 - 2:33 am

    i have a big problem, someone has hacked my facebook account and i need to hack back into it because i have changed email adress so have forgotten the password for the hotmail i use on facebook, how can i hack into my account for facebook???????????x

  46. #57 by AlbiVlore on February 24, 2010 - 9:27 am

    in the new facebook (2010) the main bar color cannot bechanged in one simple step because it is divided in more parts but we can change the color of the global container
    Ex. this is a nice change “javascript:void(document.getElementById(‘globalContainer’).style.background=’orange’);”

  47. #58 by Tara on February 26, 2010 - 1:45 pm


    I have tried your hack to retrieve facebook chat messages. However, the chat window will appear, but it will say the person is offline and show no history.

    I have tried this on firefox and internet explorer.

    Can you please please help me? ;)

    Many many thanks,

  48. #59 by tommytaco on March 1, 2010 - 3:05 am

    there is also an english (upside-down) language easter egg ;)

  49. #60 by Ellen Peters on March 3, 2010 - 1:06 pm

    Is it possible to bring up conversations on a closed facebook acct if you know the password that was used. thanks

  50. #61 by Leroy on March 4, 2010 - 5:53 pm

    To go over old facebook chats do i have to have my chat on line to see them again or can I by looking not on line?


Comments are closed.