473,503 Members | 10,178 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Testing if a window is open?

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 gives an error that windowname is undefined

if(window.windowname) doesn't work either (no error, but fails to
detect).

One alternative could be having win as a global Javascript variable.
Are there any other ways ?

Any help is appreciated.
Thanks
Laxmi
Jul 23 '05 #1
1 1310
laxmi wrote:
Is there a way to test whether a named window is open from
a separate window which may not have opened the window?

<snip>

No, the name given to a window as the second argument to the -
window.open - function has no representation in the browser's object
model. To test characteristics of a window you need to have a reference
to the corresponding window object. That reference is returned by the
call to - window.open - but if that window reference is not available
then there is no way of getting it short of calling the - window.open -
function and passing it the same name as the second argument. Pop-up
blockers not withstanding, re-calling - window.open - with the required
name as its second argument will result in a window being opened in the
event that a window with that name was not already open, and navigation
of that window if it was already open but the URL passed as the first
argument to - window.open - is not the URL of the currently displaying
page.

Richard.

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
11193
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="#"...
3
24665
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...
6
5715
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...
1
1503
by: Steve Karnath | last post by:
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...
14
11016
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...
0
1172
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...
7
3648
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...
3
1305
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...
11
2332
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...
0
7095
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7361
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7015
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5602
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3183
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
403
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.