I have the code to detect and alert the user of my pop up being blocked. Is it also possible to have the user click ok to open the pop up? If so, can someone post that code for me, please? Thanks.

Im not sure if this is what you need. But may be this wil claim your issue, simply insert the code below, between the head section of your page:

<script type="text/javascript">
<!--
window.onload = function(e) {
try { var askThem = ( confirm('Do you wish to load any popup\'s  from this site?', 'Demo') == true ) ? window.open('yourPopUp.html',target='_blank','width=500,height=500,location=no,status=no,menubar=no,toolbar=no,scrollbars=no') : alert('Welcome to my Website!'); }
catch(e) { }
}
//-->
</script>

Dont use popup that can be blocked
use a layer and have the javascript event change the layer's viisiblity
something like

<html>
<head>
<style>
.top { background-color: #000070; color: #ffffff; text-align: right; }
.bottom {  background-color: #efefef; padding: 15px; }
</style>
<script language="javascript" type="text/javascript">
<!--
(document.getElementById) ? dom = true : dom = false;
function hideIt() {
 if (dom) {document.getElementById("layer1").style.visibility='hidden';}
 if (document.layers) {document.layers["layer1"].visibility='hide';} }
function showIt() {
 if (dom) {document.getElementById("layer1").style.visibility='visible';}
 if (document.layers) {document.layers["layer1"].visibility='show';} }
onResize="window.location.href = window.location.href"
//--></script>
</head>
<body>
<button id="form" onClick="showIt();">Important Information</button>
<div id="layer1" style="position:fixed; left:20px; width:45%; top:20px; visibility:hidden;">
<div onClick="hideIt()" class="top">
<font Color="#ffffff"><Strong>Close</strong></font>
</div>
<div class="bottom">
blah blah bla<br>
Important info<br>
bla blah bla
</div>
</div>
</body>
</html>

there are two for each fuction, one IE one Mozilla

I tried the code given for the OK button on the alert message to open a window, but browsers still detect a pop up and block the window. I would like to circumvent pop up detection so the pop up immediately opens up once the OK button is pressed on the alert message.

This article has been dead for over six months. Start a new discussion instead.