Suresh Behera

The Microsoft .Net Junkies

News

Blogroll

Reading

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

Posted: Jul 22 2005, 04:56 PM by Suresh Behera | with 4 comment(s)
Filed under:

Comments

Brian said:

if the window.open("dummy.html"...) doesn't work then it executes: void window.open ( sURL,"_top",w )???

If the first one didn't work, why would the second?
# July 22, 2005 5:12 PM

rak said:

Ohh..this is funny but still working :)
# July 22, 2005 5:26 PM

Anindo said:

i want to know, how to force a User to Enable POPUP
# August 2, 2005 7:59 AM

Nakama said:

I don't think it can force the PopUp to be enabled.

Is there any script that can force the PopUp to be enabled?

# February 3, 2011 12:51 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)