<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d8211560\x26blogName\x3dTech+Tips,+Tricks+%26+Trivia\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttp://mvark.blogspot.com/search\x26blogLocale\x3den\x26v\x3d2\x26homepageUrl\x3dhttp://mvark.blogspot.com/\x26vt\x3d-5147029996388199615', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Tech Tips, Tricks & Trivia

by 'Anil' Radhakrishna
An architect's notes, experiments, discoveries and annotated bookmarks.

Search from over a hundred HOW TO articles, Tips and Tricks


Mobile Website / Printer-friendly Page Redirector


I prefer reading the mobile version of web pages (for sites that support it) or printer-friendly web pages (where available) as they load fast and are clutter-free, making reading easy.

I borrowed JavaScript code from here & there to build a simple script that takes original site links meant for a desktop browser, manipulates the URL and redirects to the equivalent mobile website or printer-friendly page or Google Mobilizer.

Try it out and adapt the code for websites which have URLs whose pattern can be manipulated to generate a web page URL for that site's mobile equivalent (with a m. subdomain) or for printer-friendly web pages.

For instance, a typical new article from The Economic Times has a URL like this:
http://economictimes.indiatimes.com/news/international-business/mexico-nears-junk-food-tax-sets-anti-obesity-plan/articleshow/25020454.cms

The URL for the same article when you view it from their mobile website is:
http://m.economictimes.com/news/international-business/mexico-nears-junk-food-tax-sets-anti-obesity-plan/articleshow/25020454.cms

By creating a simple web page locally and adapting the script mentioned above, you can use the redirection technique for other sites as well. The script uses regular expressions to move fragments of the URL around.

If you find configurable URL patterns (like the one shown above) for popular websites, please leave a note in the comments section.

Labels:

Tweet this | Google+ it | Share on FB

« Home | Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »

»

Post a Comment