Fixing Facebook in Konqueror

Posted in:

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 §

Comments should load when you scroll to here...