How Would I make an exit popunder instead of popup?

Status
Not open for further replies.

miketpowell

New member
Feb 20, 2009
755
26
0
Las Vegas
When users leave my page I want to give them a pop under with sound rather than a pop up that they probably close before it even loads. To do the pop up when they leave I'm using this :

<SCRIPT LANGUAGE = "JavaScript">
<!-- //
function openit(sURL){newwindow=open(sURL,"newwin","width=800, height=600");
}
//-->
</script>

with this in the body:

<body onUnload="javascript:openit ('http://popupurl')">

Any easy changes to that I can make to make it be a pop under instead of a pop up?

Thanks
 


set the focus to the parent window after you open the new window (below)

Code:
function openit(sURL){newwindow=open(sURL,"newwin","width=8  00, height=600");this.focus();

or use the 'blur' function on the pop under to lose its focus

Code:
window.blur()
 
  • Like
Reactions: miketpowell
^ Thanks +rep I read about the blur function and figured it's best because I want this to trigger when they are closing the parent window to go back to the site they were on before clicking on my ad(where the ad is being served opens a new window for a banner click) but wasn't not sure where I would put it in my code.
 
Status
Not open for further replies.