Solved

JavaScript: Restrict with only one window popup

Posted on 2016-07-23
4
33 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 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now