加载本地XML文件-Chrome 14 [英] Load local XML file - Chrome 14

查看:83
本文介绍了加载本地XML文件-Chrome 14的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试让Chrome浏览器加载和转换本地文件.我可以将样式表附加到XML文件,并且可以正常工作(将--allow-file-access-from-files开关添加到命令行后).但是,当尝试使用xmlHTTPRequest加载文件时,与问题加载本地XML文件完全一样在Chrome 中(见下文),它在xmlHttp.send(null)行上失败.

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?

这是该问题的代码:

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

Chrome的版本为12,我使用的是14,但我不认为这会有所作为.

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

Ghosty的回答又使我迈出了一步,它使发送生效.现在 xmlHttp.responseXML 对象为空.我设置了以下开关:

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. -允许从文件访问文件
  2. -允许文件访问
  3. -disable-web-security

推荐答案

尝试使用--disable-web-security参数

这篇关于加载本地XML文件-Chrome 14的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆