how to check internetexplorer version 8 popup block is enabled or not?

Posted by Hariinakoti under JavaScript on 9/17/2012 | Points: 10 | Views : 2847 | Status : [Member] | Replies : 16
Hi Friends,
In my webpage how to check internet explorer popup block is enabled or not using javascript?Please don't post url.
I wrote this code but it is always one result only.please check and reply me.
<script language="javascript">
var popup;
testwindow=window.open("","testwindow");
if(testwindow)
{
popup=false;
alert("PopUp Block is closed");
testwindow.close();
}
else
{
popup=true;
alert("Popup Block is open");
testwindow.close();
}</script>
Please reply asap.......

Thanks & Regards
Hari



Responses

Posted by: Muhsinathk on: 9/17/2012 [Member] Bronze | Points: 25

Up
0
Down



To turn on or off Pop-up Blocker in Internet Explorer 7 or Internet Explorer 8

1) Open Internet Explorer by clicking the Start button Picture of the Start button. In the search box, type Internet Explorer, and then, in the list of results, click Internet Explorer.

2) Click the Tools button, point to Pop-up Blocker, and then do one of the following:

a) To turn off Pop-up Blocker, click Turn Off Pop-up Blocker.

b) To turn on Pop-up Blocker, click Turn On Pop-up Blocker.

To turn on or off Pop-up Blocker in Internet Explorer 9

1)Click the Tools button, and then click Internet options.

2) On the Privacy tab, select or clear the Turn on Pop-up Blocker check box, and then click OK.

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 9/17/2012 [Member] Bronze | Points: 25

Up
0
Down
Please mark as answer if it helpful to you..That helps others who search the same..

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 9/17/2012 [Member] Starter | Points: 25

Up
0
Down
i want to check in my webpage runtime.that popup block is opened or closed. i want javascript code .please post asap

Thanks & Regards
Hari

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 9/17/2012 [Member] Starter | Points: 25

Up
0
Down
i want alert message in runtime that popup block is opened or not.

Thanks & Regards
Hari

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vikash on: 9/18/2012 [Member] Starter | Points: 25

Up
0
Down
I hope this will help you

<body onload="DetectPopUp();">

Now let's see the complete implementation of the Pop Up detecting script. DetectPopUp is the main function which determines the presence of the Pop Up blocker. If the variable popup is null than it means Pop Up Blocker is ON else its OFF. The function PrintMessage is simple used to print the messages on the form.

function DetectPopUp()
{

var popup = window.open('blank.htm','Testing','width=300,height=300');

if(popup != null)
{
// This means that popup blocker is OFF
PrintMessage('PopUp Blocker is OFF','green');

}

else
{
// This means that popup blocker is on
PrintMessage('PopUp Blocker is ON','red');
}
}
function PrintMessage(message,color)
{
document.getElementById('MyLabel').style.color = color;
document.getElementById('MyLabel').style.fontWeight = 'bold';
document.getElementById('MyLabel').innerHTML = message;
}

mark as answer if it helped you.........

Regards,
Vikash Pathak

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 9/18/2012 [Member] Starter | Points: 25

Up
0
Down
It is not working Vikash.

Thanks & Regards
Hari

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vikash on: 9/18/2012 [Member] Starter | Points: 25

Up
0
Down
Mr. Hariinakoti

I have checked its working...................
which browser u re using..........?

Regards,
Vikash Pathak

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 9/18/2012 [Member] Starter | Points: 25

Up
0
Down
Internet Explorer 8

Thanks & Regards
Hari

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 9/18/2012 [Member] Starter | Points: 25

Up
0
Down
I wrote like this your code.Please check it once
<script language="javascript">
function DetectPopUp()
{
var popup = window.open('Popuptest.htm','Testing','width=300,height=300');
if(popup != null)
{
// This means that popup blocker is OFF
PrintMessage('PopUp Blocker is OFF','green');
}
else
{
// This means that popup blocker is on
PrintMessage('PopUp Blocker is ON','red');
}
}
function PrintMessage(message,color)
{
document.getElementById('MyLabel').style.color = color;
document.getElementById('MyLabel').style.fontWeight = 'bold';
document.getElementById('MyLabel').innerHTML = message;
}
</script>
</head>
<body onload ="DetectPopup();">

<form id="form1" runat="server">
<div>
<asp:Label ID="MyLabel" Text="PopUP Test" runat="server"></asp:Label>
</div>
</form>
</body>

Thanks & Regards
Hari

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vikash on: 9/18/2012 [Member] Starter | Points: 25

Up
0
Down
Yes...
it will work, give your complete code............

Regards,
Vikash Pathak

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 9/18/2012 [Member] Starter | Points: 25

Up
0
Down
Already i posted in previous post.Please check it once & solve my prblm.

Thanks & Regards
Hari

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 9/18/2012 [Member] Starter | Points: 25

Up
0
Down
i'm using VisualStudio 2005

Thanks & Regards
Hari

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vikash on: 9/18/2012 [Member] Starter | Points: 25

Up
0
Down
you re using server control...........but u re not accessing the element like 'document.getElementById("<%=servercontrolid.clientid %>")'

<script language="javascript">
function DetectPopUp()
{
var popup = window.open('Popuptest.htm','Testing','width=300,height=300');
if(popup != null)
{
// This means that popup blocker is OFF
PrintMessage('PopUp Blocker is OFF','green');
}
else
{
// This means that popup blocker is on
PrintMessage('PopUp Blocker is ON','red');
}
}
function PrintMessage(message,color)
{
document.getElementById('MyLabel').style.color = color;
document.getElementById('MyLabel').style.fontWeight = 'bold';
document.getElementById('MyLabel').innerHTML = message;
}
</script>
</head>
<body onload ="DetectPopup();">

<form id="form1" runat="server">
<div>

remove following line......
<asp:Label ID="MyLabel" Text="PopUP Test" runat="server"></asp:Label>
with
<div id="MyLabel"></div>
</div>
</form>
</body>

Regards,
Vikash Pathak

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 9/18/2012 [Member] Starter | Points: 25

Up
0
Down
Still i didn't get.i'm new one of javascript.Please solve my problem.
I wrote like this .
<head runat="server">
<title>Untitled Page</title>
<script language="javascript">
function DetectPopUp()
{
var popup = window.open('Popuptest.htm','Testing','width=300,height=300');
if(popup != null)
{
// This means that popup blocker is OFF
PrintMessage('PopUp Blocker is OFF','green');
}
else
{
// This means that popup blocker is on
PrintMessage('PopUp Blocker is ON','red');
}
}
function PrintMessage(message,color)
{
document.getElementById('MyLabel').style.color = color;
document.getElementById('MyLabel').style.fontWeight = 'bold';
document.getElementById('MyLabel').innerHTML = message;
}
</script>

<body onload ="DetectPopup();">
<form id="form1" runat="server">
<div id="MyLabel">
<asp:Label ID="Label1" Text="PopUP Test" runat="server"></asp:Label>
</div>
</form>
</body>
</head>
</html>


Thanks & Regards
Hari

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vikash on: 9/18/2012 [Member] Starter | Points: 25

Up
0
Down
Run following code...

Still i didn't get.i'm new one of javascript.Please solve my problem.
I wrote like this .
<html>
<head runat="server">
<title>Untitled Page</title>
<script language="javascript">
function DetectPopUp()
{
var popup = window.open('Popuptest.htm','Testing','width=300,height=300');
if(popup != null)
{
// This means that popup blocker is OFF
PrintMessage('PopUp Blocker is OFF','green');
}
else
{
// This means that popup blocker is on
PrintMessage('PopUp Blocker is ON','red');
}
}
function PrintMessage(message,color)
{
document.getElementById('MyLabel').style.color = color;
document.getElementById('MyLabel').style.fontWeight = 'bold';
document.getElementById('MyLabel').innerHTML = message;
}
</script>

<body onload ="DetectPopup();">
<form id="form1" runat="server">
<div id="MyLabel">
</div>
</form>
</body>
</html>

try... if not working then i am sorry..........

Regards,
Vikash Pathak

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 9/18/2012 [Member] Starter | Points: 25

Up
0
Down
Thanq Vikash.It's not working.
Thanq for ur patience

Thanks & Regards
Hari

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response