Hello all,
I am trying to check if my new window is open and if it is change the url.
This works until I use the x in the corner to close the window. At that
point i get an error when i try to open the window again. I believe that it
is because newWindow is still active. How do I close newWindow when it is
unloaded or closed by the x. If this is truely the problem.
function openWindow()
{
if (typeof (newWindow) == "undefined" || newWindow.open == false)
{
newWindow = window.open("ht tp://www.yahoo.com", "","width=400,h eight=400");
newWindow.focus ();
return false;
}
else
{
newWindow.locat ion.href = "http://www.msn.com"
}
}
Here's my solution, seems a little redundant though.
function openWindow()
{
if (typeof (newWindow) == "undefined" || newWindow.open == false)
{
newWindow = window.open("ht tp://www.yahoo.com", "","width=400,h eight=400");
newWindow.focus ();
return false;
}
else
{
newWindow.close ()
newWindow = window.open("ht tp://www.msn.com/","","width=400 ,height=400");
newWindow.focus ();
return false;
}
}
Any help would be great, but it's not urgent as I have something that works.
Steve
I am trying to check if my new window is open and if it is change the url.
This works until I use the x in the corner to close the window. At that
point i get an error when i try to open the window again. I believe that it
is because newWindow is still active. How do I close newWindow when it is
unloaded or closed by the x. If this is truely the problem.
function openWindow()
{
if (typeof (newWindow) == "undefined" || newWindow.open == false)
{
newWindow = window.open("ht tp://www.yahoo.com", "","width=400,h eight=400");
newWindow.focus ();
return false;
}
else
{
newWindow.locat ion.href = "http://www.msn.com"
}
}
Here's my solution, seems a little redundant though.
function openWindow()
{
if (typeof (newWindow) == "undefined" || newWindow.open == false)
{
newWindow = window.open("ht tp://www.yahoo.com", "","width=400,h eight=400");
newWindow.focus ();
return false;
}
else
{
newWindow.close ()
newWindow = window.open("ht tp://www.msn.com/","","width=400 ,height=400");
newWindow.focus ();
return false;
}
}
Any help would be great, but it's not urgent as I have something that works.
Steve
Comment