Wednesday, October 10, 2007

iPhone Search Page

It takes too long to load a whole Web page just to get to a specialized search box. Fraser Speirs made a quick-loading Wikipedia search page. I've made my own with a few more sites. The searches open in new windows so that you don’t have to reload the search page later.

3 Comments RSS · Twitter

And if you encode those as a "data:" URL, then you don't even incur the initial network hit:

page1
page 2

Hmm, those URLs got mangled in the posting, but you can generate them yourself with the following snippit:

curl "http://mjtsai.com/iphone.html" | perl -0777 -e 'use MIME::Base64; $text = <STDIN>; $text = encode_base64($text); $text =~ s/\s+//g; print "data:text/html;charset=utf-8;base64,$text\n";'

Add the resulting text as a bookmark in Safari, and sync to your phone.

I think I've fixed the URLs. Also, the <STDIN> (I’m guessing that’s what it was) got removed from your Perl code. I’m a Python guy, so here’s a version in that language:

curl 'http://mjtsai.com/iphone.html' | python -c 'import sys; print "data:text/html;charset=utf-8;base64," + sys.stdin.read().encode("base64").replace("\n", "")'

Leave a Comment