i want to have a pop up console on my site so that when someone closes out his browser window a small pop up opens up but only if they close the internet explorer window if they click on a link i do not want the pop up to open
i want to have a pop up console on my site so that when someone closes out his browser window a small pop up opens up but only if they close the internet explorer window if they click on a link i do not want the pop up to open
This is the easiest way to do it, but it will most probably be caught by any decent popup blocker...Code:<html> <head> <script language="javascript"> function popup() { var page = "page_to_popup.html"; windowprops = "height=700,width=800,location=center,scrollbars=yes,menubars=no,toolbars=no,resizable=no"; window.open(page, "Pop", windowprops); } </script> </head> <body onunload="popup()"> <p>Close this window to show the popup</p> </body> </html>
Last edited by cezam; 03-14-2009 at 04:32 PM. Reason: typo
HI Rich;
Yes, and this script allows you to set a cookie that won't popup your ad more then once in a set number of days, so that you aren't annoying return surfers
Here you go....
<script language="JavaScript">
/*
One Time Popup Script
By Website Abstraction (http://www.wsabstract.com) and
Java-Scripts.net (http://www.java-scripts.net)
Over 200+ free scripts here!
*/
//number of days the cookie should
//last (0 will cause it to always pop up)
var expDays = 1;
//url of the page you want to popup
var page = "http://www.yoursitehere.com";
var windowprops = "width=650, height=500, location=yes, toolbar=no, menubar=no, scrollbars=yes, resizable=yes";
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','1')
return 1
} else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
}
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function checkCount() {
var count = GetCookie('count');
if (count == null) {
count=1;
SetCookie('count', count, exp);
window.open(page, "", windowprops);
} else {
count++;
SetCookie('count', count, exp);
}
}
window.onload=checkCount
</script>
:pinkylove:Sex is like air, you don't notice you need it until you don't have any!:pinkylove:
Does anyone know if either of these will work with pop-up blockers installed?
Regards,
Lee
This is a really good site to bookmark, it's more for HTML. But on a lot of the things you can code into others.
http://www.htmlbasix.com
i've been looking for a reliable pop-up script that wont be detected by pop-up blockers...but i think those two scripts will get detected and blocked.
nextdoorstudios have these great pop-ups. does anyone know how they work? just enter any of their sites and it comes up after you click the enter button, for eg http://www.masonwyler.com/
allan
hehh the simplest one written by me
<script>window.open('http://www.gayporntraffic.com/');</script>
Insert html markup...
bruno at altagay.com
thanks so much for the help
Bookmarks