One of my challenges involves managing windows in a JavaScript environment. When I open a child window using
window.open("http://foobar","name")
, it reuses the same window when opened with the same name, which is exactly what I want.
However, if the original parent window is closed, reopening it results in opening another child window instead of reusing the existing one. Is there a way to access the previous child window so I can avoid creating unnecessary new windows?
The main issue driving this question is that I have a Java program that periodically opens different websites and I want to avoid cluttering the screen with multiple tabs or windows. Command-line options don't offer the ability to reuse or declare targets, but JavaScript allows for declaring targets. My initial approach was to use a small JavaScript page to open a page in a window with a specific name and then close itself. Every time a new page needs to be displayed, users could navigate to this page passing in the new page link. Unfortunately, it seems like targets are tied to the creating window.
If you have any ideas or solutions relevant to my problem, please feel free to share them. Thank you!