Javascript To Remove All Facebook Apps From Your Account
This is a guest post by Gaganpreet Arora AKA bitgeek.
My Facebook app list was cluttered with useless apps accumulated over the time I had joined Facebook. The worst thing is that Facebook does not allow you to remove multiple apps in one go. You have to select one, confirm on “Are you sure?” first and then click on “Okay” when it is deleted. Very cumbersome. So I wrote a Javascript hack to remove all of the apps in one go.
Warning: This will actually delete all the apps
Step 1
Go to: http://www.facebook.com/editapps.php?v=allowed.
Step 2
Select and copy the complete code below and paste it into the address bar.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | javascript: function postwith (to,p) { var myForm = document.createElement("form"); myForm.method="post" ; myForm.action = to ; for (var k in p) { var myInput = document.createElement("input") ; myInput.setAttribute("name", k) ; myInput.setAttribute("value", p[k]); myForm.appendChild(myInput) ; } document.body.appendChild(myForm) ; myForm.submit() ; document.body.removeChild(myForm) ; } function getElementsByClassName(classname, node) { if (!node) { node = document.getElementsByTagName('body')[0]; } var a = [], re = new RegExp('\\b' + classname + '\\b'); els = node.getElementsByTagName('*'); for (var i = 0, j = els.length; i < j; i++) { if ( re.test(els[i].className) ) { a.push(els[i]); } } return a; } var arr = []; els=document.getElementsByClassName('app_row'); arr['fb_dtsg']=document.getElementsByName('fb_dtsg')[0].value; arr['remove'] = 1; arr['post_form_id_source']='AsyncRequest'; arr['post_form_id'] = document.getElementById('post_form_id').value; arr['app_id']=els[0].id.replace("editapps_allowed_",""); arr['__a'] = 1; for (i=0; i<els.length; ++i) {postwith("http://facebook.com/ajax/edit_app_settings.php", arr); arr['app_id'] = els[i+1].id.replace("editapps_allowed_","");} |
Step 3
Press Enter.
The browser may get stuck for a few moments if the list is large, so if it does, just wait a bit and it will respond back.
References
Function postwith was taken from here, and getElementsByClassName was taken from here.












{ 1 trackback }
{ 3 comments… read them below or add one }
Suggestion: You can turn this into a greasemonkey script which removes the confirmation dialog… so you just click on the (x) button and the application is removed… Handy and convenient…
P.S. Didn’t work in Chrome..
The code isn’t working for me for some reason. tested on FF and Opera
Doesn’t work for me either.. Tested in FF and Chrome