Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine if a user leaves my domain. 1

Status
Not open for further replies.

tbone317

Technical User
Feb 22, 2001
3
US
How can I determine if a user leaves my domain?
 
this works... kinda..

it only works in IE 5+, and with a little bit of tweaking it might work in Mozilla/NS6...

but, it only works if the user clicks on a link in your page to leave your site.

<html>
<head>
<title>Untitled</title>
<script>
function init()
{
var s = document.getElementsByTagName(&quot;A&quot;);
for(var i = 0; i < s.length; i++)
{
s.attachEvent(&quot;onclick&quot;, function(){if(this.hostname != document.location.hostname){var c = confirm('Are you sure you want to leave my site?');if(!c){return false;}}});
}
}
</script>
</head>

<body onload=&quot;init()&quot;>
<a href=&quot;<a href=&quot;<a href=&quot;<a href=&quot;<a href=&quot;<a href=&quot;</body>
</html> adam@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top