dinsdag 7 juli 2009

Session trick for ISI widget

I made a widget for the ISI Web Of Knowledge search page. But when I tried to perform a search the next day I got a message ISI needed a session ID first.

So I came up with a little trick. Everytime someone opens a page with my ISI widget in it (this one for instance) a tiony window is opened barely visible for the visitor in the ultimate lower right of the screen. It opens the page that ISI asks directs you to, to get a session. Within a few seconds it closes again. The session ID is stored in a cookie (by ISI) and the search box is ready for action.

Sadly this only worked in IE. In Firefox you need to click the link. So the code I made up was this one: (if you want to reuse it omit the '--!')

<--!SCRIPT language="JavaScript1.2">
function popuponclick()
{
my_window = window.open("http://isiknowledge.com/?DestApp=WOS","mywindow","status=1,width=10,height=10,left=10000,top=10000");
setTimeout('window.focus()',2500)
}

function closepopup()
{
setTimeout('my_window.close()',2500);
}

function msieversion()
{
if (navigator.userAgent.indexOf("Firefox") > 0 )
document.write("Let Op! In FireFox moet u eerst een <--!a href='javascript:popuponclick();closepopup()'>sessie<--!/a> starten.")
}
<--!/SCRIPT>

<--!body onload="popuponclick();closepopup();">

Geen opmerkingen: