title: Permission Denied When using XMLHttpRequest.Open cross browser access
body: <p>I am trying to access XMLHTTPRequest.open Method I have even included netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");</p>
  
  <p>but still its not working. </p>
  
  <p>I am using javascript and HTML to access the WebService.</p>
  
  <p>Any Help would be really great</p>
  
  <p>Code</p>
  
  <p><pre><code></p>
  
  <p>&lt;html&gt;
    &lt;Head&gt; 
      &lt;Title&gt;Calling A WebService from HTML &lt;/Title&gt;
    &lt;/Head&gt;</p>
  
  <p>&lt;Body onload='GetDataFrmWS()'&gt;
    &lt;form name="Form1" id="Form1" runat="server" method="post"&gt;
      &lt;div id="DisplayData" &gt; &lt;/div&gt;
      &lt;div id="Menu2"&gt;&lt;/div&gt;</p>
  
  <p>&lt;/form&gt;</p>
  
  <p>&lt;script language='javascript'&gt;</p>
  
  <p>var objHttp;
  var objXmlDoc;</p>
  
  <p>function GetDataFrmWS()
  {
    alert('I M Here');
    var func = getDataFromWS();</p>
  
  <p>}</p>
  
  <p>function getDataFromWS()
  {</p>
  
  <p>if(window.ActiveXObject)
    {
       try 
          {
          objHttp = new ActiveXObject('Msxml2.XMLHTTP');</p>
  
  <pre><code>    }
   catch (ex)
   {
    objHttp = new ActiveXObject('Microsoft.XMLHTTP');
   }
  </code></pre>
  
  <p>}
   else if (window.XMLHttpRequest) 
   {
     objHttp = new window.XMLHttpRequest();
     netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
   }</p>
  
  <p>strEnvelope = '&lt;soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;' +
  '&lt;soap:Body&gt;' +
  '  &lt;HelloWorld xmlns="http://tempuri.org/"&gt;' +
  '     &lt;Dummy xsi:type="xsd:string"&gt;Hello&lt;/Dummy&gt;'+
  '  &lt;/HelloWorld&gt;'+
  '&lt;/soap:Body&gt;' +
  '&lt;/soap:Envelope&gt;' ;</p>
  
  <p>var szUrl;
  szUrl = '<a href="http://kamadhenu/Quoteme/GetCategories.asmx?op=HelloWorld" rel="nofollow noreferrer">http://kamadhenu/Quoteme/GetCategories.asmx?op=HelloWorld</a>';
  objHttp.onreadystatechange = HandleResponse;</p>
  
  <p>objHttp.open('POST', szUrl, true);
  objHttp.setRequestHeader('Content-Type', 'text/xml');
  objHttp.setRequestHeader('SOAPAction','<a href="http://tempuri.org/HelloWorld" rel="nofollow noreferrer">http://tempuri.org/HelloWorld</a>');
  objHttp.send(strEnvelope);</p>
  
  <p>}</p>
  
  <p>function HandleResponse()
  {<br>
  if (objHttp.readyState == 4) 
   {</p>
  
  <p>if (window.ActiveXObject)
     {
       objXmlDoc = new ActiveXObject("Microsoft.XMLDOM");
       objXmlDoc.async="false";
       objXmlDoc.loadXML(objHttp.responseText);
       var nodeSelect = objXmlDoc.getElementsByTagName("Menu1").item(0);
       var Menu2=objXmlDoc.getElementsByTagName("Menu2").item(0);
       document.getElementById('DisplayData').innerHTML=nodeSelect.text;<br>
       document.getElementById('Menu2').innerHTML=Menu2.text; 
      }
    else
     {
      var Text=objHttp.responseText;
      var parser=new DOMParser();
      objXmlDoc = parser.parseFromString(Text,'text/xml');
      var Value=objXmlDoc.documentElement.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].nodeValue;
      var Menu2=objXmlDoc.documentElement.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[1].childNodes[0].nodeValue;
      var Menu3=objXmlDoc.documentElement.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[1].childNodes[1].nodeValue;
      document.getElementById('DisplayData').innerHTML=Value;<br>
      document.getElementById('Menu2').innerHTML=Menu2; 
      document.getElementById('Menu2').innerHTML+=Menu3; 
     }
   }</p>
  
  <p>} </p>
  
  <p>&lt;/script&gt;
    &lt;input type='Button' Text='Click Me' onclick='GetDataFrmWS()' value="Click Me!"/&gt;
    &deg;
  &lt;/Body&gt;
  &lt;/HTML&gt;</pre></code></p>