Javascript: Check If Popup Window Exists Using Its Window Name

When you create a popup window in Javascript, you use the function window.open(). The second parameter, refers to the window name which, usually is useful to avoid duplicates if you have a purpose of not having duplicates. Because of this property, the window name can be used to check if a popup window of that name exists or not.

Although there is no direct way to detect if a popup window with that name exists or not, what you can do is place the window name in an array object then browse the array’s contents to see if the window name exists or not.

Adding the window name to the array object, you can do this.

Then you can use the doesPopupExist() function to see whether the popup window with that name exists or not.

Related Posts Plugin for WordPress, Blogger...

9 comments

Leave a Reply

Your email address will not be published. Required fields are marked *