My blog has moved!

You should be automatically redirected in 6 seconds. If not, visit
http://www.mattdturner.com/wordpress
and update your bookmarks.

AdSense

Pages

Monday, April 25, 2011

Finding Text on Any Website on the iPad, iPhone, and iPod

One rather frustrating thing that I have noticed with the iPad (and iPhone) is the inability to search for text within Safari.  Well as it turns out, a simple javascript bookmark is all you need to add this functionality to any iOS device (just like my post on viewing source code).

To enable finding text within any website, follow the below instructions:

  1. Open Safari (pretty self explanatory).
  2. Create a new bookmark.
  3. In the Title window, write whatever you want your bookmark to be named (I chose "Find on Page")
  4. In the address bar add the following javascript code:  
    javascript:void(s=prompt('Find text:',''));s='('+s+')';x=new RegExp(s,'gi');rn=Math.floor(Math.random()*100);rid='z' + rn;b = document.body.innerHTML;b=b.replace(x,'$1');void(document.body.innerHTML=b);alert('Found ' + document.getElementsByName(rid).length + ' matches.');window.scrollTo(0,document.getElementsByName(rid)[0].offsetTop);

NOTE: As with the post on viewing source code, I did not develop this javascript bookmark. All credit goes to Matthew Panzarino.

0 comments:

Post a Comment