• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting the window titles

 
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 415
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can not be done since JavaScript has no control over other windows that were not opened by JavaScript.

Eric
 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
var theTitle = childName.document.title;

http://radio.javaranch.com/pascarello/2005/01/19/1106152877000.html

Eric
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 415
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic