Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Another popup question


  • From: javascript@xxxxxxxxxx (Hassan Schroeder)
  • Subject: [Javascript] Another popup question
  • Date: Wed, 18 Sep 2002 07:32:56 -0700

Gavin Cheyne wrote:

> I've been asked alter a javascript popup so that it triggers when a user
> leaves a particular area of the site. This will have to be triggered by
> onUnload so that it appears even if the user jumps to another site.

> My question is this: can I grab the url that the browser is going to, rather
> than the one its coming from?

You can *if* the user is leaving via a link on your page --

<script type="text/javascript">
function inform(e)
{
	alert(e.target.parentNode.href);
}
document.onclick=inform;
</script>
</head>
<body>
Next I'm going to <a href="here.html">here</a>
</body>

If they leave by typing something in the address bar, you won't
know where they're going, but your onunload routine can at least
determine that the unload wasn't preceded by an onclick event.

HTH!
-- 
H*
Hassan Schroeder ----------------------------- hassan@xxxxxxxxxxxxxx
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

     -- creating dynamic Web sites and applications since 1994 --