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

Find in Page Javascript

EDIT: Apparently this is now included in iOS 4.2.  Thanks go to Mowg for bringing this to my attention.

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,'<span id=" + rid + ">$1</span>');void(document.body.innerHTML
    =b);alert('Found ' + document.getElementsByName(rid).length + ' matches.');
    window.scrollTo(0,document.getElementsByName(rid)[0].offsetTop);

NOTE: The entire javascript should be on one line.  As with the post on viewing source code, I did not develop this javascript bookmark. All credit goes to Matthew Panzarino (Edit: link seems to be dead now).

Enhanced by Zemanta

13 thoughts on “Finding Text on Any Website on the iPad, iPhone, and iPod

  1. Mowg

    javscript is not necessary, the search box already does this: http://www.tipb.com/2010/09/16/ios-42-features-fi

    • necktweaker

      Well thats really convenient. Thanks for letting me know

  2. online school

    I am so ecstatic that I stumbled across this article. Thank you for you giving of this.

  3. Dallas Lemons

    Thanks a lot! I was yelling and screaming at my iPod for several hours, hehe. But finally managed to reboot it with the center and menu key. Thanks!

  4. Rosemary

    It’s truly a nice and useful piece of information. I am satisfied that you simply shared this helpful information with us. Please stay us up to date like this. Thanks for sharing.

    my web blog Rosemary
    Rosemary recently posted..RosemaryMy Profile

  5. I know this web page gives quality based articles or reviews and additional information, is there any other web page which provides such information in quality?
    web page recently posted..web pageMy Profile

  6. I know this website gives top quality based articles or reviews and more details, is there any other website which provides such details in quality?

  7. Good day! This is my first visit to your blog! We are a group
    of volunteers and starting a new initiative in a community in the same niche.
    Your blog provided us useful information to work on. You have done a wonderful job!
    Tax Services recently posted..Tax ServicesMy Profile

  8. I was hoping you'd calculate the US only share, just for fun, since Apple's US share is higher than its WW share.

  9. James Morgan

    We are so much addicted to iphone that we cannot live without it and we are so much engrossed in it that we often forget about what time it is and what we are supposed to do. it is wrong as this is a complete waste of time, I am not saying we should cut off from society what I am trying to say is that we should spend nearshore outsourcing amount of time and even that when we have nothing else to do.

  10. Michel John

    Gina Gallo, CEO of Stratix, an outsourcing managed mobile-services provider, says, “Mobility represents an extremely complex technical hurdle, which calls for competencies, experience, and focus that most enterprises — regardless of bench strength or outsourcing provider — simply don’t have.” , Outsourced IT Service Dallas

  11. Thabet la mot trong nhung nha cai uy tin dung hang dau the gioi ca cuoc truc tuyen ma con bieu tuong cua su dang cap va chat luong. Ben canh do thuong hieu THABET con duoc moi nguoi danh gia cao ve cac tro choi cung voi cac dich vu giao dich nhanh chong. wedsite: https://thabet-vn.com/

  12. iWin ra doi tu nam 2021 va ngay lap tuc tao nen lan song chan dong thi truong game doi thuong Viet Nam. iWin Club noi len voi danh hieu Song Bac Thuong Luu. Website: https://iwinct.com

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

This site uses Akismet to reduce spam. Learn how your comment data is processed.