Percia Nancy
Percia Nancy

Reputation: 403

Multiple Windows using window.open()

So as we all know if you click on a submit button that has embedded in it a onClick(windown.open(...)) this opens a new window with all the lovely attributes you specify. However if then proceed to click on the parent window and again click on the 'submit' button without closing the previous popup window, then that same window is overwritten with the new data.

Now I need a way for that window.open() script to create new windows every time it is clicked. SO in theory I could click the parent "submit" button 2 consecutive times and have 2 different child windows appear.

I'm sure it's trivial but I can't seem to find anything.

Upvotes: 30

Views: 64694

Answers (6)

Dev Gaud
Dev Gaud

Reputation: 844

In my case, the browser was blocking the pop-up window. I just allowed it to open the pop-up window.

enter image description here

Upvotes: 3

Andy_skan
Andy_skan

Reputation: 31

window.open(url, '', 'width=1000, height=500')

then, you get new popup every time to click popupbutton.

Upvotes: 3

Vishwani
Vishwani

Reputation: 623

You need to disable Track outbound links which will open only one window. Add the following javascript code to index.html file:

<script type="text/javascript">
  var clicky_custom = clicky_custom || {};
  clicky_custom.outbound_disable = 1;
</script>

Upvotes: -5

Voonic
Voonic

Reputation: 4775

try this,it will create new child, fiddle

var randomnumber = Math.floor((Math.random()*100)+1); 
 window.open(yoururl,"_blank",'PopUp',randomnumber,'scrollbars=1,menubar=0,resizable=1,width=850,height=500');

Upvotes: 13

abcd
abcd

Reputation: 3212

Check this this might help you to open new window every time.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery demo</title>
  <script src="jquery-1.9.1.js"></script>
</head>
<body>

<script>
$(document).on("click", "#btn", function(event) {
    window.open("http://www.google.com", '_blank');
});

</script>
<input type=button name="btn" id="btn">
</body>
</html>

Upvotes: 3

epascarello
epascarello

Reputation: 207491

Give each window a new window name.

window.open(url, WindowName)

Upvotes: 22

Related Questions