Connecting Tech Pros Worldwide Help | Site Map

uncaught exception: permission denied to call XmlHttpRequest.open

 
LinkBack Thread Tools Search this Thread
  #1  
Old September 2nd, 2008, 07:16 AM
Member
 
Join Date: Aug 2007
Posts: 120
Default uncaught exception: permission denied to call XmlHttpRequest.open

hello

I am using xmlHttpRequest method in my application, this method is giving problem in the following browsers

1) Internet Explorer 7
2) Mozila Firefox(2.0.0.16)

I got solution for Mozilla issue

let me explain what i did

In the about:config (for this we have to open browser and type in the address bar as about:config, after that in filter place type as signed) of mozilla brower
you need to set 'signed.applets.codebase_principal_support' to true and add the line

'netscape.security.PrivilegeManager.enablePrivileg e("UniversalBrowserRead");

in my script(means above xmlHttpRequest.open)

But I am facing this issue in IE7 there i am getting Permission Denied to open xmlHttpRequest.

Anybody knows solution for this problem
Reply
  #2  
Old September 2nd, 2008, 04:12 PM
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Age: 37
Posts: 3,780
Default

i guess you want to start a 'cross-domain-request'? it is generally a very! bad idea to rely on settings to a browser-config ... unless it is an intranet application. you may probably find this helpful?

kind regards
Reply
  #3  
Old September 5th, 2008, 05:56 AM
Member
 
Join Date: Aug 2007
Posts: 120
Default

hello,

Thanks for ur reply, i saw the url what u provided in the message

and i added the following below lines in my code but its still not working

Expand|Select|Wrap|Line Numbers
  1. var xmlHttp = null;
  2. if (window.XMLHttpRequest) {
  3.   // If IE7, Mozilla, Safari, and so on: Use native object.
  4.   xmlHttp = new XMLHttpRequest();
  5. }
  6. else
  7. {
  8.   if (window.ActiveXObject) {
  9.      // ...otherwise, use the ActiveX control for IE5.x and IE6.
  10.      xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
  11.   }
  12. }
  13.  
Is it correct what i am doing please give me solution.

thanks

Last edited by gits; September 5th, 2008 at 07:24 AM. Reason: added code tags
Reply
  #4  
Old September 5th, 2008, 07:26 AM
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Age: 37
Posts: 3,780
Default

was i correct with the assumption that you want to make cross-domain requests?
Reply
  #5  
Old September 5th, 2008, 07:46 AM
Ferris's Avatar
Member
 
Join Date: Oct 2007
Location: Shanghai
Age: 23
Posts: 102
Default

I quite agree with gits. You probably want to make a cross-domain requests. Could you post more code for detail?
Reply
  #6  
Old September 6th, 2008, 06:13 AM
Member
 
Join Date: Aug 2007
Posts: 120
Default

here with i am sending my full source code

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. ?>
  4.  
  5. <html>
  6. <head>
  7. <script type="text/javascript" src="config_js_var.js"></script>
  8. <script type='text/javascript'>
  9.  
  10. var xmlHttp
  11.  
  12. function get_username()
  13. {
  14.     xmlHttp=GetXmlHttpObject()
  15.     if (xmlHttp==null)
  16.      {
  17.         alert ("Browser does not support HTTP Request")
  18.          return
  19.      }
  20.     var url=getldap_username_utility_url;
  21.     xmlHttp.onreadystatechange=getusername;
  22.     xmlHttp.open("GET",url,true)
  23.     xmlHttp.send(null)
  24. }
  25. function getusername()
  26. {
  27.     var username;
  28.     if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  29.     {
  30.          usernamestring=xmlHttp.responseText
  31.  
  32.         userarr = usernamestring.split("<!");
  33.  
  34.         domainusername = userarr[0];
  35.  
  36.         domainuserarr = domainusername.split("\\");
  37.  
  38.         username = domainuserarr[1];
  39.         domain = domainuserarr[0];
  40.         var params;
  41.  
  42.  
  43.  
  44.         params = "user="+username;
  45.  
  46.  
  47.         window.location=feedbackforum_url+"?user="+username+"&domainname="+domain;
  48.     }
  49. }
  50.  
  51.  
  52. function GetXmlHttpObject()
  53. {
  54.     var xmlHttp=null;
  55.     try
  56.      {
  57.          // Firefox, Opera 8.0+, Safari
  58.          xmlHttp=new XMLHttpRequest();
  59.      }
  60.     catch (e)
  61.      {
  62.          //Internet Explorer
  63.          try
  64.           {
  65.               xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  66.           }
  67.          catch (e)
  68.           {
  69.               xmlHttpn=new ActiveXObject("Microsoft.XMLHTTP");
  70.           }
  71.     }
  72.     return xmlHttp;
  73. }
  74.  
  75.  
  76. </script>
  77.  
  78. </head>
  79.  
  80. <body onload='get_username();'>
  81.  
  82. </body>
  83. </html>

Last edited by gits; September 6th, 2008 at 06:52 AM. Reason: added code tags
Reply
  #7  
Old September 6th, 2008, 12:06 PM
Ferris's Avatar
Member
 
Join Date: Oct 2007
Location: Shanghai
Age: 23
Posts: 102
Default

Hi, would you please tell me the value of "getldap_username_utility_url" ?
Reply
  #8  
Old September 6th, 2008, 12:21 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,235
Default

You can use a web proxy for cross-domain requests. Another alternative is a dynamic script tag.
Reply
  #9  
Old September 6th, 2008, 04:16 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,235
Default

I'll just point out that dynamic script tags are for JavaScript/JSON only, so may not be useful here. One other alternative is Apache's mod_rewrite, if that's possible.
Reply
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.