Search For Text In Any Website In Mobile Safari With This Handy Bookmarklet

Posted by Dave Clarke on: July 22nd, 2009, 12.53 am

photo-31

Here’s a handy little bookmarklet from Cydia that could be useful to everyone, not just the iPhone jailbreakers out there. To install the bookmarklet, simply copy and paste the following text into an e-mail and send it to yourself (or find some other way to get this text onto your iPhone).

javascript:void%28s%3Dprompt%28%27Find%20text%3A%27%2C%27%27%29%29%3Bs%3D%27%28%27+s+%27%29%27%3Bx%3Dnew%20RegExp%28s%2C%27gi%27%29%3Brn%3DMath.floor%28Math.random%28%29*100%29%3Brid%3D%27z%27%20+%20rn%3Bb%20%3D%20document.body.innerHTML%3Bb%3Db.replace%28x%2C%27%3Cspan%20name%3D%27%20+%20rid%20+%20%27%20id%3D%27%20+%20rid%20+%20%27%20style%3D%5C%27color%3A%23000%3Bbackground-color%3Ayellow%3B%20font-weight%3Abold%3B%5C%27%3E%241%3C/span%3E%27%29%3Bvoid%28document.body.innerHTML%3Db%29%3Balert%28%27Found%20%27%20+%20document.getElementsByName%28rid%29.length%20+%20%27%20matches.%27%29%3Bwindow.scrollTo%280%2Cdocument.getElementsByName%28rid%29%5B0%5D.offsetTop%29%3B

Once it’s on there, copy all of the text by selecting it and then go into Safari and go to any web site. Bookmark the website to your Safari bookmarks. After that, edit the bookmark you just bookmarked and erase the entire http://www.whatever address line and double tap in the blank space and then tap on “Paste”.

Then, erase the title of the bookmark and name it “FindInPage” or whatever you want. Tap the back button and then tap Done. To test it out, go to any website and then tap the bookmarks icon and select “FindInPage” and then follow the directions. You should now be able to find text in whatever web site you’re currently on. Kudos to the original author Rafael Cimatti for coming up with this little gem.

photo-1photo-21

15 Comments

  1. Apple really needs to implement this natively into safari, as well as search bookmarks without having to add them to the home screen.

  2. I do really needed something like that. It works perfect!
    Thanks a lot for this tip.

  3. Hey guys, thanks for the tip…I just tried it and it works great!

  4. This is amazing!

  5. wow sweet!

  6. Sweet! That “from Cydia” part made my heart sink but relieved this is for everyone. Gotta love these JavaScript bookmarklets. Thanks!

  7. Thanks
    Love it

  8. Awesome !! :D

  9. Ahh….Yeah, this did not work for me.

  10. Great stuff I’ve been waiting for an internet page search for ages, almost as long as cut n paste…

    Now if only Apple will make the same thing but with next and previous buttons coz I’m lazy…

    Many thanks guys…

  11. does this require updated 3.0 software? cuz i haven’t updated yet and it’s not working for me. and for some reason after i save the bookmarklet, it adds in “25″ before the word “color”. is that normal??

    • Yes, iPhone OS 3.0 is required otherwise unexpected results will occur.

  12. Nice.

  13. Doesn’t seem to work for me. I checked the code, and it was copied correctly. Maybe OS 3.1 rendered it useless?

  14. OK, tried it from here: ipuhelin.com/en/safariplus/ and it works.

Leave a Response