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("http://www.yahoo.com","","width=400,height=400");
newWindow.focus();
return false;
}
else
{
newWindow.location.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("http://www.yahoo.com","","width=400,height=400");
newWindow.focus();
return false;
}
else
{
newWindow.close()
newWindow = window.open("http://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 1 1496
Steve Karnath (remove this text) wrote: 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("http://www.yahoo.com","","width=400,height=400"); newWindow.focus(); return false; } else { newWindow.location.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("http://www.yahoo.com","","width=400,height=400"); newWindow.focus(); return false; } else { newWindow.close() newWindow =
window.open("http://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
----------------------------------------------------------------------
Hey, I have some sample code, it's so old, I'm not sure it works,
but why don't you try this:
if (oWindow2==null || oWindow2.closed)
.....
where oWindow2 is the object reference (not the name of the window),
and is saved as a global javascript variable (outside any function).
This ostensibly tests to see if the window is closed.
Bruce Brodinsky This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: laxmi |
last post by:
Is there a way to test whether a named window is open from a separate
window which may not have opened the window?
I have tried using:
if(windowname == null)
win = window.open(...)
This...
|
by: Marshall Dudley |
last post by:
When I do the following line in Netscape, the popup loads as it should,
but the parent window usually, but not always, reloads as well.
<a href="#"...
|
by: NeverLift |
last post by:
But, if it's not open, I don't want to open it . . . using
window.open will open it if it doesn't exist, even if the url in that
open is null (the window is then empty -- but it's open).
The...
|
by: gsb |
last post by:
Don't know if this is the right place to post this JavaScript issue.
If not, could someone point me in the right direction please.
I am trying to make a "cross browser compliant" floating...
|
by: D. Alvarado |
last post by:
Hello,
I am trying to open a window containing an image and I would like
the image to be flush against the window -- i.e. have no padding or
border. Can I make this happen with a single call to a...
|
by: calfdog |
last post by:
I am pleased to announce version cPAMIE 1.6 the Web automation tool for
Internet explorer.
If your looking for a fast way, easy to learn way to drive your browser
check out PAMIE.
Is PAMIE...
|
by: anthony.turcotte |
last post by:
Hi,
I've looked for a solution to this problem on google, read posts in
this newsgroup and I still haven't found anything that could help me.
Here's the scenario.
1. User accesses...
|
by: Ant |
last post by:
Hi,
Does anybody here know how to test user controls on the fly. I build the
user control, as well as the application I am testing it in but the changes
made to the user control aren't seen unless...
|
by: VK |
last post by:
In the continuation of the discussion at "Making Site Opaque -- This
Strategy Feasible?" and my comment at
http://groups.google.com/group/comp.lang.javascript/msg/b515a4408680e8e2
I have...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |