All Unkept
Posted in: KDE  —  2 September 2007

Fixing Facebook in Konqueror

I got fed up waiting for Facebook to fix their website that recently broke in Konqueror, so I did it myself. I was correct in thinking that the problem was just this line of code:

delete Object.prototype.eval;

...which seems to serve no purpose in other browsers, but deletes the global 'eval' function in Konqueror (as you would expect from the ECMA 262, Edition 3 specification). Konqueror doesn't have a GreaseMonkey equivalent (yet), so here is a quick summary of how to do an equivalent hack.

  • Install privoxy:
    wajig install privoxy
    
    (assumes you are using Debian/Ubuntu and have wajig installed).

    NB: Privoxy does all kinds of other web filtering by default. If you don't like that, as I don't, just truncate the original config 'action' files:

    cd /etc/privoxy/
    sudo rm *.action
    sudo touch global.action default.action standard.action user.action
    
  • Configure Konqueror to use 127.0.0.1, port 8118 as the HTTP proxy (use 'Manually specify the proxy settings' and press 'Setup').
  • Configure Privoxy to redirect one javascript file to a different version that removes the offending line of code, by adding the following lines to /etc/privoxy/user.action:
    { +redirect{http://lukeplant.me.uk/privoxy/facebook/base.js} }
     static.ak.facebook.com/js/base.js
    

    (of course, this will break as soon as Facebook update this file).

  • Check that privoxy and the redirect are working by going to:
    http://config.privoxy.org/show-url-info?url=http%3A%2F%2Fstatic.ak.facebook.com%2Fjs%2Fbase.js
    You are looking for a line that says:
    +redirect {http://lukeplant.me.uk/privoxy/facebook/base.js}

Assuming it all worked, you should now have a functional Facebook again! (I do, anyway)

For performance, in Konqueror configuration you can add 'static.ak.facebook.com' as the only domain to go through the proxy (you have to enable a check box and add the domain to a list, it's fairly obvious in the GUI). You should do this after you have checked it is all working, as otherwise even the config.privoxy.org address that we used for checking won't be redirected to the proxy, and will instead go to a page on the real internet telling you that your privoxy setup isn't working.

Comments §

§ On 3 September 2007, luke wrote: 260
I should have added: you may have to do a refresh (F5) to get the modified javascript file. You should be able to see it has worked if the little 'bug' icon in the bottom right of the status bar no longer appears on Facebook pages.

§ On 5 September 2007, mirshafie wrote: 261
What a great trick! I kept opening Opera to do simple things that didn't work with Konqueror.

Last night when I followed your howto it didn't work, but when I started using Facebook this morning it did. Seems like privoxy just needed some time to know it was alive.

Thanks!

§ On 9 September 2007, Matthew K Poer wrote: 264
There has to be a better way around this than setting up an HTTP proxy. I know there isn't a way to inject javascript into Konqueror, but there must be another option.

§ On 1 December 2007, luke wrote: 286
BTW, Facebook fixed this ages ago (14 Sep 2007 I think), this hack shouldn't be needed.

§ On 13 September 2009, Chris wrote: 481
My facebook chat opens in a new window. Any fix for this?

§ On 13 September 2009, Pri2sh wrote: 482
@ Chris
This one helpedme:
http://www.khattam.info/2009/09/13/solved-facebook-chat-opens-in-a-new-window-in-konqueror/


Closed for comments.