| Author |
Getting the window titles
|
sreenath reddy
Ranch Hand
Joined: Sep 21, 2003
Posts: 415
|
|
Hi Is there anyway to access the titles of all the IE windows open in our system . i dont think so this is possible as controlling other windows from our application will make the things meaningless with respect to security But still i need to confirm if this is possible Regards Sreenath
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
You can only access the titles of the windows that were opened by JavaScript and that are on the same domain. If browser settings are adjusted, you can read the titles of other domains, but only on the windows that the function opens. You have no control over any other windows that are open. Eric
|
 |
sreenath reddy
Ranch Hand
Joined: Sep 21, 2003
Posts: 415
|
|
Hi eric Let me explain the scenario where i need this i will first open an URL by typing in the address bar and then window comes in that with Title Say 'X' . When the user clicks Ctrl-N i want to check in the onLoad function whether already a window with Title X is open So can i get that done ?? if so can you paste some piece of code for that thanks a ton
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
can not be done since JavaScript has no control over other windows that were not opened by JavaScript. Eric
|
 |
sreenath reddy
Ranch Hand
Joined: Sep 21, 2003
Posts: 415
|
|
What if while opening the first page i will open that using window.open during the onload .........then can i do that ?? and can u tell me how can atleast windows opened by javscript can be accessed ??
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
var theTitle = childName.document.title; http://radio.javaranch.com/pascarello/2005/01/19/1106152877000.html Eric
|
 |
Yuriy Fuksenko
Ranch Hand
Joined: Feb 02, 2001
Posts: 413
|
|
Just to be clear, I don't think the solution I have is acceptable. But it does exactly what you asked for, and I think is theoretically interesting. It probably won't work with popup blockers, and has lots of disadvantages. You can try to modify that code by using try/catch around it, and assuming it not found if exception happend also, I tested it on IE 6, on local hard drive, so may not work with other browsers and security issues.
|
 |
sreenath reddy
Ranch Hand
Joined: Sep 21, 2003
Posts: 415
|
|
Hi yuriy Ur solution looks pretty good ...but even i want to avoid entering that already a window exists if i click refresh ....can u give me an idea to bypass that in some way its ok even if the code is specific to IE
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
I personally think that you need to try to handle this on a serverside situation some how and avoid JavaScript. There is no way you are going to be detecting if a person opens up a new instance of IE and goes to the same page. JavaScript has no control over that. JavaScript is limited, if it wasn;t you would have a major spyware issue. Plus image going to s site and it can detect all your browsers, they woul be able to grab information on the toher sites. Eric
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: Getting the window titles
|
|
|