Martin Weigert’s thoughts on the social web. And life.

 
« Back to blog

Search through webpages on iPad and iPhone

For some reason, Safari on iPhone and iPad doesn't have a function to search a page for specific words. On the iPhone that never bothered me since most iPhone specific sites limit the amount of content to be shown, which means you see at a glance if the word you are looking for is there.

On the iPad that's different, since one usually visits regular websites, not mobile ones. And in this case I find it useful to be able to search a webpage.

In a forum somewhere on the web I found a good solution to this problem:

Just create a bookmark to a random website, choose "edit" and copy the code below into the address field. You might want to change the name of the bookmark to "search" or something. Press "done" and there you go: now you can search a page by using the "search" bookmark.

The code:

javascript:var%20db=document.body,sb='%3Cspan%20style=\'background-color:%23FFFF00;%20font-weight:%20bold\'%3E',tm=prompt('Find%20text:'),sm='/('+escape(tm)+')/gi',se='%3C/span%3E';void(db.innerHTML=db.innerHTML.replace(eval(sm),sb+'$1'+se));

Comments (4)

Jun 13, 2010
Jesse Travis said...
Thank you so much. Very helpful!
Jun 19, 2010
Neil Bywater said...
Great solution, thanks:-)
Jul 10, 2010
Pete said...
Thanks, works great
Aug 30, 2010
Tapster said...
Great tip. Works by highlighting every occurance of the text searched for. Thanks.

Leave a comment...