Annoyed by Guardian Facebook App?

Are your friends sharing links to the Guardian Facebook app in their twitter feeds but you don’t use Facebook and want to see the original guardian page?

Unfortunately due to the way the web (and Facebook) works, if somebody copies the URL in their browser and posts it to twitter you’ll be looking at the same thing as them, and if that was a guardian Facebook app, but you haven’t logged into Facebook, Facebook wont tell us anything so we can’t redirect you back to the guardian.

However, most modern browsers support special bookmarks with javascript in them, called Bookmarklets, and since the original Facebook url has the important path data needed for the guardian site, it’s possible to manipulate the current url to take you back to the guardian site without logging into Facebook.

Basically, drag this link:
to your bookmarks toolbar up above this page, then click this link: Are these the 10 heaviest albums ever made? and then click the new fb->g link on your toolbar and you should go to the guardian site.

This will only work if you are not logged into facebook.

How does it work?

The Bookmarklet is a link with a javascript protocol (before the colon). Your browser will execute the code when you click the button, and it will do so within the context of your current page.

It gets the current url, and looks for a parameter called cancel_url. That’s where the url for the original apps.facebook.com is. Next we replace apps.facebook.com/theguardian with www.guardian.co.uk, then we update window.location with the result. This causes your browser to load the new url, and you should be on the guardian site.

Note that it does no error checking, it does not handle unusual guardian urls (that might not start www.guardian.co.uk) nor does it check whether there is a cancel_url before acting.