I want to choose a specific window, and perform operations on that window- I will pass that window as a parameter to another function which does the work…
I know beforehand, that the title of the windows is (for example) “XYZ”
How do I select the window in browser with that title?
I found that in javascript there are ways to assign a title to a window, but I couldnt find a way to search for and find the window which has a specific title.
You cannot select other windows, unless you’ve already got a reference to it.
There are two methods to get a reference:
window.openerproperty holds a reference to the window which opened the current one.window.open()also offers a reference.Each reference to another window will be a
windowobject.window.document.titlecan be used to read the value of the title. (wherewindowis the reference to the other window).Cross-domain restrictions will prevent other windows from being read, though.
See this answer to read the document/window object of embedded frames.