Uses of Java Scripts on Facebook - FB Java Scripts Collection 2013



Facebook is pretty awesome, but it is far from perfect. More than once, I’ve heard complaints about some of Facebook’s technical aspects. Sadly, Facebook isn’t open-sourced, so users can’t change anything themselves – or can they?

By using simple pieces of Javascript code, or by applying Firefox Greasemonkey userscripts, users can change the appearance and workings of Facebook themselves.

Learn how to hack Facebook accounts for fun, or tweak something useful. Believe me, it really is all in your hands.

Facebook Account Javascript Hacks

In these following hacks we’ll be using basic Javascript to toy around with Facebook. Note that we’re not going to hack into Facebook accounts, or anything of the like. Most of these ‘hacks’ are temporary and will disappear once you refresh the page. They also won’t be visible to users on other computers. So why are we doing it? – Because it’s fun!


These Javascript snippets, which we’ll supply below, simply need to be pasted into the address bar. Hit enter, et voila!

Changing Profile Colour

This will change the colour of your Facebook bar to a color of choice.


Just paste the following code in your address bar and hit enter. You can replace ‘red’  with any color you want – black, white, green or even orrange. If you want to reverse the effect, press Ctrl+F5 for a hard reload of the page.

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

View Chat History with Offline Friends

Unfortunately, you can’t normally view the chat history of online friends. If you’re trying to remember something that was said, waiting for them to come back online is one hell of a bother. Instead, you can just use this – pretty useful – Javascript hack.

First of all, we need to get your friend’s Facebook ID. When you visit his page indirectly (through your friends list or by using the search engine), you’ll be able to see it as a number in the address bar.


Another way to retrieve someone’s ID is by going to the Friends widget on their page, and right-clicking See All. Then you’ll have to copy the link location and paste it in your address bar.


Once you’ve got someone’s ID, simply paste the following code in your address bar, replacing 1122334455 with the relevant number.

javascript:buddyList.itemOnClick(1122334455);


Other Javascript hacks

The preceding two hacks are without doubt the most impressive or useful ones. Below are some of the other tricks you can pull off by using Javascript. We’re not going to deep on this because they’re all things you can do manually as well.

Change chat status to invisible:
javascript:statusControl.sendVisibility(false);

Change chat status to visible:
javascript:statusControl.sendVisibility(true);

Close all chat windows with person 1122334455:
javascript:chatDisplay.tabs[1122334455].tabXOnClick();

Open application tab:
javascript:applicationDock.toggleTab();

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

Bring up friends list:
javascript:buddyList.toggleTab();

Facebook Greasemonkey Hacks


Greasemonkey is one of the best firefox add-ons in existence. By using ‘userscripts’, you can customize nearly every website. Read more about Greasemonkey in .

Today we won’t be focusing too hard on Greasemonkey itself, but on some of the great Facebook-specific userscripts.

Facebook Auto-login – One of the simplest, but perhaps also one of the most useful userscripts you’ll find. This one will automatically log into Facebook, as long as Firefox remembers your password, saving you a lot of hassle.

Auto-Colorizer for Facebook – This script will recolor your Facebook page by applying the color scheme of the most dominant picture currently showing on the page. As you can imagine, this can create some exciting, and also ambient effects.

FacebookDeletes – If you want to get rid of a lot of people at once, this is your man. This script can bulk delete friends, making the masacre all the easier.

Remove All Facebook Ads – Adblock still tends to miss a lot of Facebook ads. This script, frequently updated, will remove all thinkable Facebook ads, creating a completely click-safe Facebook environment.

External Apps Blocker – One of the most irritating things on Facebook are the abundance of quizzes, quote generators, and the like. Filtering all external app ‘stories’ from your homepage will be a lot easier if you use this script.

If you know any other cool Javascript tweaks, or Greasemonkey hacks, feel free to mention them in the comments section below!