Click to See Complete Forum and Search --> : onUnload question


ingvare
02-16-2003, 08:16 AM
The triggering of the event "onUnload" is done because the user clicked on a link to something else. In the code for the onUnload event, how do I fetch this URL?

Ingvar

ingvare
02-17-2003, 10:51 AM
Hi, thanks for your reply. I tried a few variations but could not make it work. I eithewr got error "Object Required" or xxxx.srceElement is null or no object on the test. see below

<HTML>
<HEAD>
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="pragma" CONTENT="-1">
</HEAD>
<BODY onunload="testroutine()">
TestPage
</BODY>
<SCRIPT LANGUAGE="JavaScript">
function testroutine()
{
var targetURL;
alert("hello1");
//targetURL = window.event.srcElement.href;
//targetURL = event.srcElement.href;
//targetURL = self.event.srcElement.href;
//targetURL = document.forms[0].event.srcElement.href;
//targetURL = document.event.srcElement.href;
alert("hello2");
}
</SCRIPT>
</HTML>

ingvare
02-18-2003, 02:17 AM
>You need to go study your JavaScript a little better.

Well I agree on that. I really do work with Notes/Domino so its mostly LotusScript. I have a book "JavaScript Complete" but it does not cover these matters. What would you suggest?

Anyway, It does not seem possible to figure out where a user is heading in all cases (clicking "Home" or "Back") even though the "onunload" event is triggered so I am stuck anyway. Unless the "onbeforeunload" is a better choice to figure where the user is heading

ingvar