How to use bookmarklets to adjust font sizes in mobile Safari

For the most part, mobile Safari serves its purpose as the default web browser in iOS. But it’s definitely not feature-packed. And to get more options, you typically have to either install a third party browser, or add a jailbreak tweak.

But OSXDaily points to a cool trick that makes adding a new feature to Safari as easy as creating a couple of bookmarklets. Have you ever wanted to quickly change the font size of a website on your iPhone or iPad? Well, here’s how…

Step 1. Open Safari on your iPhone or iPad and create a bookmark (for any page).

Step 2. Rename the bookmark to either ‘+’ or ‘-‘, depending on which code you are copying below, and tap save.

Step 3. Open your Bookmarks menu up, tap edit, and select the item you just created.

Step 4. Now delete the URL, and copy and paste in one of the following:

for the ‘+’ bookmark, copy:

javascript:var p=document.getElementsByTagName(‘*’);for(i=0;i<p.length;i++){if(p[i].style.fontSize){var s=parseInt(p[i].style.fontSize.replace(“px”,””));}else{var s=12;}s+=2;p[i].style.fontSize=s+”px”}

for the ‘-‘ bookmark, copy:

javascript:var p=document.getElementsByTagName(‘*’);for(i=0;i<p.length;i++){if(p[i].style.fontSize){var s=parseInt(p[i].style.fontSize.replace(“px”,””));}else{var s=12;}s-=2;p[i].style.fontSize=s+”px”}

Step 5. Once finished, tap Done once to save the bookmark, and again to exit Edit mode in the Bookmarks menu.

That’s all there is to it! Now when you are browsing a website, and the font is too small, simply open your Bookmarks menu (if you have the ‘Always Show Bookmarks Bar’ option activated on your iPad, and you added the above bookmarklets to your Bookmarks Bar, they’re always visible) and tap the ‘+’ symbol. If the text is too large, tap the ‘-‘ symbol. And to reset the font size, simply refresh the page.

Sure, iOS 5 users can always pop into Reader and adjust the font size that way. But not all websites are built for that particular setting. And even if you don’t find this tip particularly useful, there’s a good chance that someone else will.

Questions?

[Marco Kirsch]