How to force User to Enable POPUP

I was writing some popup enable script which looks as follows.

Create three HTML page such as login.html, dummy.html and Youhavetoenable.html

1.  Write following JavaScript code in login.html page

<script type="text/javascript">
 function showMessage ( sURL )
 {
  var w = "top=20,left=30,width=840,height=800,status=yes,scrollbars=yes,resizable=1";
  void window.open ( sURL,"_top",w )
 }
 result = window.open("dummy.html", "popped", "width=10, height=10, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no");
 if (result != null)
 {
  // Not blocking
 }
 else
 {
  //blocking
  showMessage ( 'Youhavetoenable.html' );
 }

</script>

2. Create dummy.html .This is page do nothing other than just to test the window.open.You can write following code on it.

<html>
<head>
<title>Suresh Behera</title>
</head>
<body>
<script language=javascript>
 window.close();
</script>
</body>
</html>


3.Create Youhavetoenable.html  page.This page give message to enable the popup

The above tips tested on IE and it works fine for me.If you have any other idea please let me know.Yes,this will not work if scripting is disabled.

For more about popup.Please have a look on following URL

http://www.microsoft.com/windowsxp/using/web/sp2_popupblocker.mspx
http://www.google.com/support/toolbar/bin/topic.py?topic=116&hl=en

 

Cheers.

Suresh Behera

4 Comments

Comments have been disabled for this content.