Creating custom search boxes for library use- a second look

A couple of months back , I wrote a post entitled Creating custom search boxes for library use. This is one of my top 10 most popular blog posts and also one of the posts which I’m most proud of because it is one of my few posts that I feel is pretty original.

In that post, I figured out a way to create search widgets/boxes for practically any database, which can be embedded in many places including subject guides.

However since then, circumstances have conspired to make the post a little out-dated

Firstly the example given on Scopus, no longer works as Scopus changed their urls. That of course is easily fixed. Secondly, I figured out a slightly better way to improve the stability of the widget.

A more stable search widget?

You can read through the original post again on how to create a custom search-box for EconLit (via OVIDSP). At the risk of quoting myself
I have being a big fan of Opensearch plugins since I discovered them and I even created a big bunch of them here for almost every database we support on various platforms.

Once you have created a opensearch plugin, you know exactly what format the url should be sent to get the result. For instance, I know that to send a keyword query to EconLit (OvidSP) with the term TEST, you should send the following string.

Creating custom search boxes for library use

The slight improvement to this would be to send the following string instead,

Both methods should work, but I’m told that the later string would avoid caching problems.

So the rest follows as before and so the final code you should use is as follows

<script type=”text/javascript”>
function econlitSearchGo(){
var url=”“;
var url2=”.mp&D=econ
var searchInputeconlit = document.getElementById(“econlitSearchInput”); + encodeURIComponent(searchInputeconlit.value) + url2);


<div id=”enterText” style=”position: absolute; left: -1000em; width: 20em;”>Enter your search terms:</div>
<input type=”text” id=”econlitSearchInput” size=”30″ onKeyPress=”handleKeyPress(event,this.form)” />
<input type=”button” value=”Search” onclick=”econlitSearchGo()”/>


nter your search terms:
ter your search terms:

If the javascript above looks tough to understand, refer to the original post again, it isn’t really that hard to understand and modify.


So there you have it, my improved custom search widget. If you know a bit more javascript you can do more fancy tricks, for example selecting 2 or more searches from a list and search them in different tabs comes to mind.