Bookmarklet to Convert Mobile Facebook link to Desktop Facebook Link

If you’re on a Desktop browser, it is easy enough to see the Mobile version of a Facebook Link. All one has to do is replace the ‘www‘ in the URL with ‘m‘ and press Enter. However, if one is sent the mobile version of a Facebook link, it is not that straight forward to convert it into the desktop format if you’re surfing on a Desktop browser. The default format of the mobile link that Facebook generates is as follows:

https://m.facebook.com/story.php?story_fbid=10154615255996455&substory_index=0&id=13527056454

Unfortunately, just changing ‘m’ to ‘www’ will not get you to the desktop version of this Facebook link. Instead, it will give you “This page isn’t available” error. To actually get to the desktop link, it has to be converted into the following format:

https://www.facebook.com/13527056454/posts/10154615255996455

The ‘id’ portion of the link became the first number in the above URL, while the ‘story_fbid’ portion of the link became the second number. However, it is painful to do this manually every single time. Since the time I started working on Alt News, I have had to do this exercise numerous times. To make it easier for me and everyone else out there, I created a small bookmarklet that can be dragged to the Bookmark bar.

M2D-FB

Drag the above link to your Bookmark bar, and whenever you are stuck with the mobile version of a Facebook post on a Desktop browser, click the above link to instantly convert it into a Desktop Facebook post.

The code for this bookmarklet is as follows:

function getParam(param) {
  var url = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
  for (var i=0;i<url.length;i++) {
         var params = url[i].split("=");
         if(params[0] == param)
          return params[1];
  }
  return false;
}

location.href='http://www.facebook.com/'+getParam("id")+'/posts/'+getParam("story_fbid")

The getParam function has been borrowed from here.

Bookmarklet creator at http://mrcoles.com/bookmarklet/ was used to convert the Javascript code into a Bookmarklet.

About Pratik Sinha

Linux Nerd, Socialist, Atheist, Adventuristic, Nature Lover, Geeky.

1 comment

Leave a Reply to SilverBull Cancel reply