Saturday, 16 April 2011

Enable iPhone Safari Text Search with Safari+ and More


Safari+ is not an iPhone app, it’s just a webpage. But it’s not just any webpage, it contains useful links that enhance your mobile Safari browsing experience by adding text search capability, display just images on any page, display just the links on any page, scroll to the end, and language translations. The concept is simple: simply bookmark in your iPhone the bookmarklet. From iPuhelin’s website, makers of what they call Safari+:
Bookmarklets are little pieces of
Javascript code that can be saved as
ordinary bookmarks in your web browser.
They enhance your browsing experience
by giving you super-instant access to
useful tools and special functionality.

How does it work? Simply open up Safari on your iPhone and browse to the Safari+ link. From there, scroll down a bit and choose the functionality you want to add to Safari. Let’s assume you want to add "Find in page" capability. Click on it and bookmark the resulting link. That link’s full URL is:
After saving the bookmark in Safari, go to your bookmarks and edit the URL by deleting all the text at the beginning of the URL up to the word "javascript" so that you’re new bookmark is:
  • javascript:void(s%3Dprompt(’Find text%3A’%2C”))%3Bs%3D’('+s+’)'%3Bx%3Dnew RegExp(s%2C’gi’)%3Brn%3DMath.floor(Math.random()*100)%3Brid%3D’z’ + rn%3Bb %3D document.body.innerHTML%3Bb%3Db.replace(x%2C’%241’)%3Bvoid(document.body.innerHTML%3Db)%3Balert(’Found ‘ + document.getElementsByName(rid).length + ‘ matches.’)%3Bwindow.scrollTo(0%2Cdocument.getElementsByName(rid)[0].offsetTop)%3B
What this does whenever you visit this bookmark is execute this useful piece of Javascript code on the current website you are browsing. The Javascript code here will give you a prompt for any string to find, simply type it in and you will see the number of results found and the search string highlighted. Heck, you can test it out right now without the iPhone. Copy and paste the "javascript:…" text into your address bar right now and see what happens. Then imagine the same thing happening in your iPhone.
Head on over to the Safari+ website on your iPhone and start bookmarking these useful functions now. Their main page has links to illustrated steps on how to add each bookmarklet. More bookmarklets are available at Pastebud,Instapaper, and iPastelet. A great hack suggested by Safari+ is to give your saved bookmarks icons with Emoji emoticons.

0 comments:

Post a Comment

Powered by Blogger.