0

I have the following code snippet for opening a child window which should stay on top of the parent window

"var a = window.open('" + url + "', '_blank','height=400,width=400,status=yes,toolbar=no,menubar=no,location=no');";

However, popup window is opening and not shown on top of the parent window.

And I would like to keep the keep the child window stacked and no other child windows should be allowed to open until I close the already opened child window popup.

This issue is only in IE browser.

Jacob
  • 14,463
  • 65
  • 207
  • 320
  • `"no other child windows should be allowed to open until I close the already opened child window popup."` I don't think that's possible (or ethical). As well as controlling whether your window is above the parent window or not. – N.J.Dawson Sep 01 '16 at 08:59
  • This might help - http://stackoverflow.com/questions/5660700/javascript-to-open-popup-window-and-disable-parent-window – Rahul Pandey Sep 01 '16 at 09:11

3 Answers3

1

$(document).ready(function(){
$('#popup-btn').click(function(){
setTimeout(function(){
$('#popup').css('display','block');
},10);
});
});
#parant{
width:300px;
height:300px;
 background:#ff8800;
 margin:10px auto;
   border-radius:15px;
}
#popup{
 display:none;
  width:300px;
  height:300px;
  background:#ff8800;
  margin:10px auto;
  border:1px solid blue;
  border-radius:15px;
}
.name{
  width:100%;
  height:50px;
  background:blue;
  color:#fff;
  text-align:center;
  border-radius:15px 15px 0px 0px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="popup">
<div class="name">Child Popup</div>
</div>
<div id="parant">
  <div class="name">Parant Popup</div>
<button id="popup-btn">POPUP</button>
</div>
Samudrala Ramu
  • 2,088
  • 1
  • 15
  • 36
  • The code snippet which I have shown would not support jquery, it will only support Javascript. Thanks – Jacob Sep 01 '16 at 09:15
  • I have to pass javascript code as below `String javascript = "var a = window.open('" + url + "', 'a','height=400,width=400,status=yes,toolbar=no,menubar=no,location=no'); ";` – Jacob Sep 01 '16 at 09:18
  • Do You Want That Code In JavaScript – Samudrala Ramu Sep 01 '16 at 09:18
  • Yes, I have to pass javascript code as below `String javascript = "var a = window.open('" + url + "', 'a','height=400,width=400,status=yes,toolbar=no,menubar=no,l‌​ocation=no'); ";` – Jacob Sep 01 '16 at 09:19
1

Try this..

define the 'top'

var a = window.open('" + url + "', '_blank','height=400,width=400,status=yes,toolbar=no,menubar=no,location=no,top=0,left=0');

Refer this link

https://developer.mozilla.org/en-US/docs/Web/API/Window/open

1
<script>
function popup(){
document.getElementById('pop-div').style.display="block";
}
</script>
<body>
  <div style="width:100px; height:100px;display:none;" id="pop-div"></div>
  <button onclick="popup();">pop</button>
</body>