March 09, 2006

'Search the Links On This Page' Form

Just a quick pick up on the Search This Page's Links bookmarklet (updated version here) to say that I've popped the code used in the bookmarklet into a Javascript file (Search Page Links form script) so that a search box can now be easily added to a page that will let you enter a search term that can be used in a Yahoo search over all the pages linked to from the current page:

It's easy enough to include the script. Just add this to the body of your page:

<script type='text/javascript' src='searchPageLinks.js'></script>

I haven't thought about styling/positioning, making the script robust etc., but if anyone does try it out, has comments, bugs etc., please mail me. (In particular, I need to pop the functions into a namespace so they don't clash with similarly named functions on my own blog pages! (I think that's why the form doesn't work on my blog homepage, becuase it does seem to work elsewhere...))

Possible things to include function/usability wise if I take this any further are:

  • a listing of all the links to be searched;
  • a checkbox by each so you can (de)select it from the pages to be searched;
  • a (de)select all button to ease the link (de)selection process.

I also need to miss out links that start javascript: rather than http:// in the list of links to be searched. Update: fixed.

PS I also limited the length of the Yahoo search URL which means that not all the links will be included on the page (perhaps making it more important that I provide some meams of showing what links are to be searched?)

I also wonder whether it would be better to require each link to be searched to be given a particular class value (searchable perhaps?), e.g. something along the lines of:

<a href="http://example.com/my/path.html" class="searchable">link text</a>

Posted by ajh59 at March 9, 2006 10:14 PM
Comments