|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
One Pop-Up Per Visitor Script
As mentioned in another thread, having too many pop-up's is very annoying. Here is a script that will do ONLY 1 pop-up per visit. This script sets a temporary cookie to track if the pop-up (actually it's a pop-under) has already been shows.
This is the javascript code: Code:
var popunder="/pu.html"
var winfeatures="width=468,height=80,scrollbars=0,resizable=0,toolb ar=0,location=0,menubar=0,status=0,directories=0"
var once_per_session=1
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(off set, end))
}
}
return returnvalue;
}
function loadornot(){
if (get_cookie('popunder')==''){
loadpopunder()
document.cookie="popunder=yes"
}
}
function loadpopunder(){
win2=window.open(popunder,"",winfeatures)
win2.blur()
window.focus()
}
if (once_per_session==0)
loadpopunder()
else
loadornot()
This code can be modified in several ways: 1. The line var popunder="/page.html" can be modified so that the new window will contain the advert / page of your choice. 2. On the second line of code, the "width" and "height" of the popup can be modified. This sets the width and height of the pop-up. 3. Other window features can be specified as seen on the second line of code. For example if you want the window to have scrollbars, change "scrolbars=0" to "scrollbars=1". Hope this is useful to some.
__________________
Darrin J. Ward, a Professional SEO Consultant and Original Founder of SEO Chat (this site), Google Dance Tool & some other cool stuff! * Rankings Reporter - Track your Website's Keyword Rankings in Google & Yahoo. * ChatButton - Free AJAX Chatboxes to embed onto any Webpage - super-easy copy/paste setup!. |
|
#2
|
||||
|
||||
|
Just what I was looking for.
Thanks Darrin!
__________________
Fred@Twin-Towers.net |
|
#3
|
||||
|
||||
|
Is there anyway to make the pop up be a full new window?
Thanks |
|
#4
|
|||
|
|||
|
Quote:
Setting var winfeatures="width=468,height=80,scrollbars=0,resizable=0,toolb ar=0,location=0,menubar=0,status=0,directories=0" to var winfeatures="" should do it (you will get a "normal" browser window with all the menus, scrollbars and toolbars). If you want a full findow with NO scrollbars/toolbars/menus set it to var winfeatures="scrollbars=0,resizable=0,toolbar=0,location=0,menu bar=0,status=0,directories=0" |
|
#5
|
|||
|
|||
|
Hello everybody,
I didn't work with js a lot, so I have a questions about the script: I'm using php header and if I use this script in it to pop-up my guestbook it will pop it up every time when somebody sees my first (index) page. What do I need to add to pop it up everywhere (of course it hasn't been done before) - well, including it in php header will do that - but I don't want it poping up on the index page (before visitors can actually see the website - if you know what I mean Thanks |
![]() |
| Viewing: SEO Chat Forums > Other > SEO Scripts > One Pop-Up Per Visitor Script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|