access denied in browser (IE8) when I try to retri

2019-08-28 16:39发布

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条回答
对你真心纯属浪费
2楼-- · 2019-08-28 17:18

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

查看更多
登录 后发表回答