Forum Moderators: open
-s-
<script>
function GetCookie() {
var cookiecontent = '';
if(document.cookie.length > 1) {
var cookiename = 'WINDOW325=';
var cookiebegin = document.cookie.indexOf(cookiename);
var cookieend = 1;
if(cookiebegin > -1) {
cookiebegin += cookiename.length;
cookieend = document.cookie.indexOf(";",cookiebegin);
if(cookieend < cookiebegin) { cookieend = document.cookie.length; }
cookiecontent = document.cookie.substring(cookiebegin,cookieend);
}
}
return cookiecontent;
}
function PutCookie(d) {
var exp = '0';
if(d > 0) {
var now = new Date();
then = now.getTime() + (d * 24 * 60 * 60 * 1000);
now.setTime(then);
exp = '; expires=' + now.toGMTString();
}
document.cookie = 'WINDOW325=yes; path=/' + exp;
}
function WINDOW325() {
var mycookie = GetCookie();
if(mycookie == 'yes') { return; }
PutCookie(0);
var WINDOW325 = window.open('http://www.mysite.com/NoNonSense/myfolder/index.html','','scrollbars=yes,height=565,width=615,resizable=yes');
self.focus();
}
setTimeout("WINDOW325()",0);
// -->
</script>
Do you mean you want to target subsequent links to a window opened by a previous link? In that case you should be able to test with and if() statement whether the window already exists and target the load accordingly. Rather than opening the window directly, open it by assigning it to a variable then test for the existence of the variable.
Just set the second parameter of the window.open function to a string--this assigns a name to the popup window and will keep you from spawning a new window each time. Rather, the same window is reused. Here I have assigned the window the name indexWindow:
var WINDOW325 = window.open('http://www.mysite.com/NoNonSense/myfolder/index.html','indexWindow','scrollbars=yes,height=565,width=615,resizable=yes');
ajkimoto