Click to See Complete Forum and Search --> : Popunder Javascript


mlittle1105
06-27-2003, 03:13 PM
I'm trying to figure out how to create a Javascript that will launch a pop-under when the user closes his/her web browser. If such a thing does not exist, how about a script that launches a pop-up when a user closes a window? Please help!:confused:

Jona
06-27-2003, 03:21 PM
It is not recommended that you use popups, however, you could do something like this:


<body onUnLoad="var mWin = window.open('page.html','pageName','width=400,height=400,scrollbars=no,menubar=no,status=no,copyhist ory=no'); mWin.blur();">


[Jona]

mlittle1105
06-27-2003, 04:27 PM
This page shows what I want to have happen. See how the pop-up comes up when you close the window or leave the domain?

http://www.iolo.com/partners/adnetwork/sm.cfm?source

Jona
06-27-2003, 04:32 PM
Replace "blur()" with "focus()"

[J]ona

mlittle1105
06-27-2003, 04:35 PM
This page shows what I want to have happen. See how the pop-up comes up when you close the window or leave the domain?

http://www.iolo.com/partners/adnetwork/sm.cfm?source

mlittle1105
06-27-2003, 04:36 PM
are you referring to the code you posted earlier, or the URL that I posted?

Jona
06-27-2003, 04:40 PM
The code I posted earlier. If you want the exact effect from that site which you linked to, you can simply view the source code and learn from it to figure it out.

[J]ona

mlittle1105
06-27-2003, 04:46 PM
When I use the code you posted, it doesn't work. I must be doing something wrong.

I copied the source code from that other page and pasted it in the appropriate place in my file, but it doesn't work either. Here's what I pasted in:

<SCRIPT LANGUAGE="Javascript">
<!--
var bitLinkClicked = 0;

function openPop()
{
if (bitLinkClicked == 0)
window.open("lastchancesm.cfm?coupon=TAN2", "", "width=600,height=275,-menu");
}
//-->
</SCRIPT>

I then changed it to:

<SCRIPT LANGUAGE="Javascript">
<!--
var bitLinkClicked = 0;

function openPop()
{
if (bitLinkClicked == 0)
window.open("popup.html?coupon=TAN2", "", "width=520,height=370,-menu");
}
//-->
</SCRIPT>

Am I missing something? I changed the name of the file it pulls up and the sizes. I don't know what that coupon=TAN2 is supposed to mean.

Jona
06-27-2003, 04:49 PM
<body onunload="openPop();">


[J]ona

mlittle1105
06-27-2003, 04:51 PM
Where does that go?

Jona
06-27-2003, 04:53 PM
That is your BODY tag. It is necessary to start the body of the document you are creating.

[J]ona

mlittle1105
06-27-2003, 05:00 PM
I am completely confused.

Look, THIS is what I have in the body tag of my document (index1.html):

<body onUnLoad="var mWin = window.open('popunder.html','Bullguard firewall','width=520,height=370,scrollbars=
no,menubar=no,status=no,copyhistory=no');" leftmargin=50 bgcolor="#CC0000" text="#000000" link="#000000" vlink="#000000" alink="#000000">

Is this correct or not?

I have no idea where you are saying to insert this tag:

<body onunload="openPop();">

Jona
06-27-2003, 05:04 PM
The code you posted should work fine. You said you were using the function popUp() so I showed you how to incorporate that into your caller (event).

[J]ona