Solved

popup window unpon exit of domain only

Posted on 2003-10-29
2
248 Views
Last Modified: 2013-12-24
I need code that make a window popup upon exit of a domain only, not on unload of any one page.


Thanks.
0
Comment
Question by:CFDevHead
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
jyokum earned 500 total points
ID: 9647499
admittedly, this is some strange code... but it seems to work


<!--    closeDomain.html   -->
<html>
<head>
<script>
function checkExit(){
      var win = window.open("","","width=10,height=10");
      win.blur();
      win.document.write("<script>");
      win.document.write("setTimeout(\'checkDomain()\',1000);\n");
      win.document.write("function checkDomain(){ ");
      win.document.write("try {");
      win.document.write("if(window.opener) var x = window.opener.location.href;\n");
      win.document.write("self.close();}");
      win.document.write("catch(e){window.alert(\'you left my domain!!!\'); self.close();}");
      win.document.write("}");
      win.document.write("<\/script>");
}
</script>
</head>

<body onunload="checkExit();">
<a href="closeDomain.html">stay at domain</a><br>
<a href="http://www.experts-exchange.com">leave domain</a><br>
</body>
</html>
0
 
LVL 9

Author Comment

by:CFDevHead
ID: 9647517
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What You Need to Know when Searching for a Webhost Provider
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question