JavaScript: Search word hit-highlighting

I found searchhi, which is a slick JavaScript library by Stuart Langridge that will highlight keywords in your documents when the referring link to you page comes in from a seach engine such as Google:

searchhi JavaScript library is a way of automatically highlighting words on a page when that page was reached by a search engine. In essence, if you search, for example, Google for some words, and then follow a link from the search results to a searchhi enabled page, the words you searched for will be highlighted on that page.”

I was actually thinking of using PHP to do this, but Stuart’s JS code seems to be a better alternative given that the performance hit is on the client-side.