Search
Winners

Win Prizes

Social Presence
Like us on Facebook
Advertisements
Ads

how to check internetexplorer popup block is enabled or not?

Hariinakoti
Posted by Hariinakoti under JavaScript on 9/21/2012 1:44:19 AM | Points: 75 | Views : 5024 | Status : [Member]

Hi Friends,
             as for my requirement i want to check internet explorer popup blocker is enabled or not?i wrote code like this in javascript.This code taken only else part.Because in that variable taken only object.Please solve my problem.Please see my code.

<head id="Head1" runat="server">
    <title>Untitled Page</title>
<script language="javascript" type="text/javascript">
    ns4=document.layers
    ie8=document.all
    ns6=document.getElementById&&!document.all
    var xWin=null; var ticks=6;
    function ChangeLabel0(txt){
    if(ns4){document.layers.label0.innerHTML=txt}
    if(ie8){document.all.label0.innerHTML=txt}
    if(ns6){document.getElementById("label0").innerHTML=txt}
    }

    function StartT(){
     StartPopup();
     window.focus();
     ChangeLabel0("<b>Popup window appears in "+ticks+" sec. Wait please...</b>");
    }
    function StartPopup(){
     xWin=window.open("popuptest.htm","","");
     alert('xWin ' +xWin);
     setTimeout("test_xWin()",700);
    }
    function test_xWin(){
          alert("typeof(xWin)="+typeof(xWin));
          alert("typeof(xWin.location.href)="+typeof(xWin.location.href));
          alert("xWin="+xWin);
          alert("xWin.location.hash="+xWin.location.hash);
      if ( (xWin==null)||(typeof(xWin)=="undefined") ||(typeof(xWin.location.hash)!="string")||(xWin.location.hash!="#abc"))
      {sMsg="<font color=#FF0000><b>A popup killer is detected</b></font>";}
      else{sMsg="<font color=#008000><b>There is NO popup killer detected</b></font>";};
        alert("xWin="+xWin+" type="+typeof(xWin)+" typeloc="+typeof(xWin.location.hash)+" hash="+xWin.location.hash);
      window.focus();
      ChangeLabel0(sMsg);
    }
    function hi()
    {
     alert('hi');
     StartT();
     return false;
    }
</script>
</head>
<body onload="return hi();" >
<form id="form1" runat="server">
<div id="label0"></div>
</form>
</body>
</html>


Thanks & Regards
Hari

Comments or Responses


Login to post response