access denied in browser (IE8) when I try to retrive xml file

和自甴很熟 提交于 2019-12-13 03:11:46

问题


I have the following

<script type="text/javascript">
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("MSXML2.XMLHTTP");
  }
xmlhttp.open("GET","test.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML; 

And then the file continues with other stuff... The problem is that I get an error on the line with xmlhttp.open which says Access Denied in IE 8. I run all this files locally and all of them are in the same folder... what can I do to get rid of this error? I googled it a little bit and it seems that the error remains. Any ideas?


回答1:


Am not sure but most probably the issue may be because of the cross domain. I.e xmlparsing needs the xml and corresponding files to be uploaded in somje local server. Try using Tomcat or Wamp and call from the server using "http://localhost/appname". hope it works



来源:https://stackoverflow.com/questions/9555674/access-denied-in-browser-ie8-when-i-try-to-retrive-xml-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!