danielvaughan
Technical User
Hi Guys,
I seem to be having a problem with !win.closed and Internet Explorer 6. My script works perfectly well in firefox. I've included window.alerts to confirm this. IE just does not recognise !win.closed and therefore, wont enter that part of the script.
By the way, the script is fed some basic window address and size data from Macromedia Flash.
Any help would be greatly appreciated.
This is the script i'm working with:
function shopcart(mypage,myname,w,h,features) {
if (!window.win) {
window.alert('loading for the first time');
if(screen.width){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
}else{
winl = 0;wint =0;
}
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();
return ">> Hi Flash.";
}else {
if (!win.closed) {
window.alert('switching to already open window');
win.window.focus();
}else {
window.alert('window already opened, but now closed - opening again');
if(screen.width){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
}else{
winl = 0;wint =0;
}
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();
return ">> Hi Flash.";
}
}
}
I seem to be having a problem with !win.closed and Internet Explorer 6. My script works perfectly well in firefox. I've included window.alerts to confirm this. IE just does not recognise !win.closed and therefore, wont enter that part of the script.
By the way, the script is fed some basic window address and size data from Macromedia Flash.
Any help would be greatly appreciated.
This is the script i'm working with:
function shopcart(mypage,myname,w,h,features) {
if (!window.win) {
window.alert('loading for the first time');
if(screen.width){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
}else{
winl = 0;wint =0;
}
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();
return ">> Hi Flash.";
}else {
if (!win.closed) {
window.alert('switching to already open window');
win.window.focus();
}else {
window.alert('window already opened, but now closed - opening again');
if(screen.width){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
}else{
winl = 0;wint =0;
}
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();
return ">> Hi Flash.";
}
}
}