读取本地XML文件时Mozilla中的Jquery AJAX错误

我正在从XML文件中读取一些属性。 它在IE上工作正常但在mozilla Firefox中没有。 我的应用程序在用户的本地计算机上本地运行,我正在从本地驱动器读取XML。

在Firefox中,打开文档的AJAX调用不成功。 下面是我的代码片段。

如何让它在Firefox中运行?

$.ajax({ type: "GET", url: "../branding.xml", dataType: "xml", success: function(xml) { parseXml(xml); alert('success'); }, error: function(xml) { alert('error'); } }); 

我在Firebug中收到以下通知:

 "[Exception... \"Access to restricted URI denied\" code: \"1012\" nsresult: \"0x805303f4 (NS_ERROR_DOM_BAD_URI)\" location: \"file:///M:/index/js/jquery-1.7.2.js Line: 8240\"]" 

我需要在本地运行此应用程序,不能将其放在Web服务器上。 有什么建议?

根据同源的Mozilla文档 ,您的XML文件必须位于页面源目录的子目录中。

例如,您的网站可能结构如下:

  my-site/ index.html script.js data/ branding.xml 

另一方面,这将不起作用:

  my-site/ source/ index.html script.js data/ branding.xml