• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 76
  • Last Modified:

JavaScript: Restrict with only one window popup

Hello Folks,

I've a website & with an option to open window popup.
I am able to open window popup & restricted with same popup (in case user click again to open window popup) but once request post then again, new popup opens (if user clicks on that option).

FYI, used
var newWindowpopup = null

checked for equal to null OR closed then open new window otherwise not

Open in new window

Do you have any thought to open same window popup (if already open) irrespective post to server? As you know, it should be browser compatibility.

Best Regards
  • 3
2 Solutions
The second argument of the window.open call is the name of the window:

window.open( url, name, specs, replace ) See: window.open on w3schools

If you use window.open(url1, "myWindow") and then later window.open(url2, "myWindow") then url2 should load in the earlier created window.

You can still assign the window to a variable such that later you can add focus to make the 2nd opening pop in front.
MohitPanditAuthor Commented:
I tried with that but once request post to server then variable of JavaScript initializes again & it doesn't work & open new window.

Best Regards
MohitPanditAuthor Commented:
I believe that it should be done with the help of cookies
MohitPanditAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now