Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

JavaScript: Restrict with only one window popup

Posted on 2016-07-23
4
Medium Priority
?
71 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
  • 3
4 Comments
 
LVL 49

Assisted Solution

by:Roonaan
Roonaan earned 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
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 the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

916 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