View Full Version : Opened window?
karthikraja
08-29-2006, 07:47 AM
Hi
I have a set of different IE windows. Now I want to write a script in Javascript of VBScript which would give me all the title names of all the IE browser windows open. Could I do that??
Thanks.
RysChwith
08-29-2006, 08:30 AM
It might be possible, if you've kept track of the reference for each window. The easiest way would be to store the references in an array as you create them. You could then parse through the array and grab each title.
As for actually grabbing the title, I can think of how you'd grab the document title -- the part in the <title> tag -- but I don't know how you'd grab the window title.
If the document title suffices, it'd be:document.getElementsByTagName( "title" ).item( 0 )Rys
karthikraja
08-29-2006, 09:00 AM
Thx for the response.
I think you did not understand my question properly. I have already opened some websites and web links which are different URL's.
Now I have my own script which shows all the list of URL's on a list box. The user can close or open the page from that List box. I hope you understood my question.
How do i get the URL and links from Javascript or VBscript.
Thanks in advance.
RysChwith
08-29-2006, 01:22 PM
I'm not quite sure that I do. This is what I'm understanding at the moment:
You have a page with a listbox of URLs. The user can click on one of those URLs to open a popup window with that page in it. If the user clicks the same URL again, that popup window closes. If the user clicks a different URL, another popup appears with that page in it, which can be closed in the same fashion.
Am I understanding correctly?
Rys
karthikraja
08-30-2006, 03:39 AM
oh God ...........Please Save meeeeeeeee
I dint mean that sir..
User has opened some webpages. Say yahoo.com , google.com, htmlforums.com and hotmail.com.
Now I need to write a script which can fetch the opened browser's URL's / Titles and put them in a list box(This is done in my webpage). Now the user can select these links from my list box and Click close buton. Now that particular window should be closed.
I hope my sentence makes sense now.:confused:
Thanks
RysChwith
08-30-2006, 08:24 AM
Ah, got it.
Unfortunately, it's not possible. JavaScript can only affect windows that have been opened through JavaScript, and then only if you have the reference to the window, which is generated by the window.open() call.
For example, take the following statement:var newWin = window.open( "http://www.google.com", "google", width=500,height=400" );The window.open() function returns a reference to the window created, which gets stored in the variable newWin. As long as newWin remains in scope, you can use it to affect that window. Once the reference is lost, however, it's lost for good.
Of course, you can also do this:window.open( "http://www.google.com", "google", width=500,height=400" );In this case, the reference to the window gets lost immediately, because it wasn't stored in a variable. In this instance, nothing can be done to the window after it's been created.
Anything opened by a target = "_blank" link or by hitting the "New Window" menu item is entirely inaccessibly to scripting.
I know all of this to be true for JavaScript, and am about 90 percent certain that it's also true for VBScript.
Rys
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.