Archive for category Other
Comments
The commenting function on my blog has been out of order, but is now back on track. Feel free to leave a comment when ever you’d like!
On page search for Mobile Safari on the iPhone
Posted by Martin in JavaScript, Other, Tip on 2009-07-30
My older brother Joel just got home from Italy – and with him he brought an new shiny iPhone 3GS for me! So why bother getting it all the way from Italy you may ask? First of all it’s not released yet in Sweden (or maybe that’s today actually). Secondly and more important, what makes Italy (and Belgium) different from other European countries is that you can buy iPhones without any carrier restriction. You can use any carrier you want!
Anyways. I’ve been using it for two days now and I LOVE IT! Everything I got annoyed with and irritated over using my HTC Touch Diamond is gone. I must say, Windows Mobile sucks! Compared to the iPhone’s OS, WM is nothing! It’s like they come from different planets.
There is one thing that has been bothering me though. You can’t search the text on a page with Mobile Safari. When you view large pages on a relatively small screen, it’s necessary to be able to search it. Luckily there is a solution to the problem. At The iPhone Blog Rene Ritchie describes how you can to it with a simple bookmark! It sounds a bit weird, but all you need to do is to create a bookmark and replace the bookmark URL with some JavaScript (see code below). Then whenever you need to search a page, just click on the bookmark, enter your search text into the JavaScript prompt and click OK. The script will then highlight all the matches on the page. Super neat!!
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
First blog post
This is my first blog post on my brand new blog.
Testing testing …