I don't think you can have the user's destination if he write an new address in the location bar. But you can know where he will go when he clicks on a link in YOUR page. just insert the following code in each link :
onClick="HandleRef(this.href);">go to myserver.com</A>
Now between the HEAD tags :
<SCRIPT LANGUAGE="javascript">
function HandleRef(ref)
{
// Do what you want with the ref variable,
// which is the next location. By ex :
alert("You will go to : " + ref);
}
</SCRIPT>
Let me tell what I need to do.
I want to popup a window for vistors leaving my website.
I set a flag in the beginning, and when the visitor leaves page, the unload event is called, I check the flag and if it is set, I popup a page. If the visitor clicks on links within my website, I use the onclick event to turn off the flag so that there is no popup by the onunload event.
But when the visitor reloads the page, there will be a popup. Is there any workaround for this?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.