Another revolutionary utility by me: add "find in page" support to most web browsers!

Discussion in 'iOS Apps' started by Menneisyys, Jun 19, 2009.

  1. Menneisyys

    Menneisyys Well-Known Member

    Dec 12, 2008
    1,594
    0
    0
    Hi guys and gals, hope you'll find my little contribution useful :)



    I’ve long been complaining about the lack of any “find in page” functionality in most mobile Web browsers. Now that I’ve played a bit with JavaScript scriptlets, I can proudly present a working solution to this problem.

    All you need to do is, independent of the Web browser you use, add the following favorite:

    javascript:var searchText=prompt("Enter the text to search for","");document.body.innerHTML= document.body.innerHTML.replace(new RegExp(searchText,"gi"),"<font size=10 style='color:blue; background-color:yellow;'>"+searchText+"</font>")

    You can name it anything and can also safely change the following parameters:
    the text “Enter the text to search for”,
    10 after size (you can use any number here; the larger the number, the bigger characters it will use)
    blue after style and
    yellow after background-color (any English color name will do here) to your liking.

    After having done this, when you’re on a page where you’d like to search an expression for, just go to Favorites, click / tap this one; in the pop-up dialog, enter the expression to search for and press OK. All the occurrences will be highlighted.

    How should you add this favorite?

    Click THIS link. (A technical note: the functionality of the scriptlet itself has nothing to do with the go.to website. I’ve only used it as it’s really-really short. I could have used any else Web address; all you need to do is adding a question mark after the address and, after that, copy the scriptlet itself.) After this, depending on your (mobile) platform, do the following:

    1. iPhone

    1.1 the built-in Safari


    a. You’re taken to the website. If you take a look at the URL in the address input field, you’ll see the actual code is still preceded by “go.to free short URL redirect and web forwarding service. Nevertheless, we’ll remove it after adding the favorite.

    [​IMG]

    b. Add it as a standard favorite (press the + icon at the bottom and select Add Bookmark). You can name the new favorite anything; in the screenshot below, I’ve named it “Find txt”:

    [​IMG]
    Tap Done.

    c. After having returned to the webpage, go to favorites (tap the “book” icon) and tap the Edit button:

    [​IMG]

    Tap the just-added favorite (here, it’s the second from the top).

    d. Go to the second row; now it’s editable, unlike when it was first added. The screenshot below shows the cursor being at the end of the address:

    [​IMG]

    e. Tap and hold the URL area (as you’d do with positioning the cursor in the main address entry field of Safari) and scroll to the beginning of the address, just in front of the “j” of “javascript”. The screenshot below also shows the magnifying glass emphasizing the position of the cursor:

    [​IMG]

    f. Now, on the virtual keyboard, press Delete several times until everything is deleted in front of “javascript”. The URL should be the following:

    [​IMG]
    Tap Done.

    g. You’re taken back to the previous Web page. Let’s give our tool a quick try: try to find all occurrences of, say, “Web”. To do this, bring up Favorites again (the “Book” icon) and select “Find txt” – as you’d select a favorite. You’re presented a text entry dialog, where you can directly enter the text to search for and highlight:

    [​IMG]

    h. After pressing OK in the text entry dialog, all occurrences of “Web” have been highlighted:

    [​IMG]

    Pretty nice, eh?
    1.2 iPhone with a third-party Web browser

    Unfortunately, the following browsers, while they do allow editing URL’s right when you add them, don’t work as expected: Journey Web Browser 1.0 and fgBrowser 2.5. While they do allow saving modded favorites, nothing happens when you click in the first and “The URL can’t be shown” is displayed in the second.

    You will want to prefer the built-in find-in-page capabilities of Perfect Browser 1.0, iCab Mobile 1.5 and Air Browser 1.1. (Note that the last two don’t allow for any kind of favorite URL editing at all.)

    All in all, I don’t know of any (quality – I haven’t tested the lower-quality ones in this respect; for example, QuickSurf 1.2, Full Screen Web Browser 1.1.1 and Wide Web with Twitter 2.3.1, which all support favorite URL editing) third-party iPhone browser to support this scriptlet (or scriplets at all).

    Finally, VanillaSurf 1.2 (my favorite third-party Web browser for iPhone OS 3.0 – too bad it doesn’t support in-page searching; that is, it severely lacks URL editing capabilities) and CaizerWeb 1.0.2 don’t support URL editing and, when passed, direct javascript URL’s in the address field are not accepted. Multi-Full Browser 1.1.0 doesn’t support URL editing either.

    Note that, as my iPhone OS 3.0 phone isn’t jailbroken, I couldn’t test whether the manual editing of favorite databases is of any use – as is the case with Internet Explorer Mobile under Windows Mobile.
    (Note that the version numbers above reflect the current (06/19/2009) state of all these browsers. By the time you read this, they may have changed.)

    2. Windows Mobile

    With Internet Explorer Mobile, you’ll need to do a bit of hacking as you can’t save scriplet bookmarks. Don’t be afraid: it’s easier than you may think.

    Let’s start with adding any favorite. It can be anything – we’ll delete the URL from it afterwards.

    Select Menu / Add to favorites:

    [​IMG]

    Here, I’ve renamed the favorite to “Find txt”. No, don’t try to edit the URL and save the one starting with JavaScript: it’ll show an error:

    [​IMG]

    Instead, on your handset, go to the \Windows\Favorites folder and edit the favorite URL you’ve just created. If you name the favorite “Find txt”, then, the file will be named accordingly; that is, Find txt.url.

    In the second row, after “URL=”, just change the previous URL (here: go.to free short URL redirect and web forwarding service) to the new one. Paste the new one. To make your life easier, I recommend the WinCE file system plug-in for Total Commander and doing all this on the desktop.
    In the first screenshot below, I’ve shown the to-be-deleted text highlighted; in the second, after replacing it with the above scriplet:

    [​IMG]
    [​IMG]

    Make sure you store the changed file back to your phone. Now, fire up any Web page you’d like o highlight the occurrences of a word on, go to your favorites and select the finder scriplet. A dialog is displayed:
    [​IMG]

    and click OK (left softkey). The results speak for themselves:

    [​IMG]
    [​IMG]

    On other operating systems, you will need to do roughly the same – that is, upon saving the favorite, just chop off the leading go.to free short URL redirect and web forwarding service.
     
  2. chrisrushing

    chrisrushing Well-Known Member

    May 21, 2009
    510
    0
    0
    Graphic Designer
    Chattanooga, TN
    Wrong section............... man this feels like SPAM.
     
  3. GaiaIllusion

    GaiaIllusion Well-Known Member

    May 6, 2009
    1,239
    0
    0
    Student
    &#21152;&#25343;&#22823;
    Heck, this still seems useful though. And with copy/paste function in 3.0, it shouldn't be too hard to use. :)
     
  4. Menneisyys

    Menneisyys Well-Known Member

    Dec 12, 2008
    1,594
    0
    0
    Yup, sure it isn't a gaming-related post - still, as a LOT of iPhone / Safari users have been asking for the "find in page" functionality for ages, I took the liberty to post it here so that it has the biggest exposure. After all, it's a free trick&tip - I certainly don't make money out of it.
     
  5. Menneisyys

    Menneisyys Well-Known Member

    Dec 12, 2008
    1,594
    0
    0
    Yup - it works great with copy / paste. (For the favorite to store, however, you don't need copy / paste; it runs on previous OS'es as well as all you need to do to make it work is URL editing, not copy/pasting.)
     
  6. Mew2468

    Mew2468 Well-Known Member

    Oct 20, 2008
    1,652
    0
    0
    Vancouver, BC
    #6 Mew2468, Jun 19, 2009
    Last edited: Jun 19, 2009
    Why? Because the post is long?

    I think it's very useful - thanks for sharing! :)
     
  7. Menneisyys

    Menneisyys Well-Known Member

    Dec 12, 2008
    1,594
    0
    0
    Yup, wanted to explain every single step as, for someone not having ever "installed" a scriptlet on his or her iPhone, URL editing (and the logic of how this is all done) can be overwhelming.
     
  8. AttackOfThePwned

    AttackOfThePwned Well-Known Member

    May 28, 2009
    884
    0
    0
    Photographer
    San Francisco, CA
  9. Mew2468

    Mew2468 Well-Known Member

    Oct 20, 2008
    1,652
    0
    0
    Vancouver, BC
    I was referring to this post that called your post spam:
     
  10. Menneisyys

    Menneisyys Well-Known Member

    Dec 12, 2008
    1,594
    0
    0

    Wowz! Thanks for pointing this out! I'll check out how they have implemented this, how they do the synchronization (instead of the manual, URL-editing way I've explained) and will post an update to my guide.
     
  11. Menneisyys

    Menneisyys Well-Known Member

    Dec 12, 2008
    1,594
    0
    0
    UPDATE (06/21/2009 1:36 CET):

    1.) There are some other scriplets HERE (thanks to “AttackOfThePwned” at TouchArcade for pointing this out); among other things, another highlighting one even capable of counting the number of hits and scrolling to the first occurrence. I haven’t tested it for compliance. Note that the tutorial only states synching these bookmarklets via a desktop Safari; of course, they can also be (directly) deployed on your iPhone - or, if they’re compatible – again, I haven’t checked – under other operating systems.

    2.) As has been explained in many of my iPhone- and Windows Mobile-related articles, the built-in Safari has a shortcoming compared to for example Opera Mini: it doesn’t allow for quickly scrolling to the bottom of the page. (Without external help like this, it may be VERY hard to scroll down to the bottom of a long page to, say, check out the latest posts in a forum like that of DPReview). I’ve managed to fix this issue too. All you need to do is use the following scriptlet:

    javascript:window.scrollTo(0,100000)

    To quickly deploy it, just click THIS and do what’s explained in my former article.
     
  12. Menneisyys

    Menneisyys Well-Known Member

    Dec 12, 2008
    1,594
    0
    0
    UPDATE (12/01/2009): I’ve posted an entire tutorial to adding scriplets. In addition, the new article has a lot of additional goodies:
    - Find in page with Next functionality (!)
    - New versions of the lifeclever.com scriptlets deployable right on the iPhone, even in Safari
    - A complete report on all (scriptlet-capable) iPhone Web browsers’ compliance of handling purely Javascript (clickable) links (that is, ones that don’t start with http:// but with javascript: )

    Please see http://www.iphonelife.com/blog/87/complete-tutorial-video-extend-functionality-your-iphone-web-browser
     

Share This Page