Solved

JavaScript: Restrict with only one window popup

Posted on 2016-07-23
4
56 Views
Last Modified: 2016-08-28
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
0
Comment
Question by:MohitPandit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 49

Assisted Solution

by:Roonaan
Roonaan earned 500 total points
ID: 41725615
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.
0
 
LVL 5

Author Comment

by:MohitPandit
ID: 41727594
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
0
 
LVL 5

Accepted Solution

by:
MohitPandit earned 0 total points
ID: 41737269
I believe that it should be done with the help of cookies
0
 
LVL 5

Author Closing Comment

by:MohitPandit
ID: 41773563
thanks
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to count occurrences of each item in an array.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question