Load local XML file - Chrome 14

喜欢而已 提交于 2020-01-14 03:42:08

问题


I've been trying to get Chrome to load and transform local files. I can attach a style sheet to XML files and that works fine (once the --allow-file-access-from-files switch is added to the command line). However, when trying to load files using xmlHTTPRequest pretty much exactly as in the question Loading local XML file in Chrome (see below), it fails on the line xmlHttp.send(null).

Does anyone know why or can offer assistance?

Here's the code from that question:

function readxml()
{
    xmlHttp = new window.XMLHttpRequest();
    xmlHttp.open("GET","test.xml",false);
    xmlHttp.send(null);
    xmlDoc = xmlHttp.responseXML.documentElement;
}

The version of Chrome there was 12, I'm using 14 but I wouldn't have thought that would make a difference.

Edit

Ghosty's answer got me one more step, it got send to work. Now the xmlHttp.responseXML object is null. I have the following switches set:

  1. --allow-file-access-from-files
  2. --allow-file-access
  3. --disable-web-security

回答1:


Try --disable-web-security parameter



来源:https://stackoverflow.com/questions/7591840/load-local-xml-file-chrome-14

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