无法使用锚标记从服务器打开xml文件

时间:2013-09-12 07:19:29

标签: javascript html file anchor

我在服务器中有一个xml文件我试图在用户点击链接时在浏览器中打开它,所以我设置了如下链接。但它没有打开文件。

代码:

<a title="View XML" href="file://///90.0.0.15/docmgmtandpub/PublishDestinationFolder/index.xml" target="_blank"> Click here </a>

我也尝试使用如下的javascript:

function openFL()
{

    window.open("file:////90.0.0.15/docmgmtandpub/PublishDestinationFolder/index.xml"); 
}

如果我复制路径并尝试直接在浏览器中打开它工作正常但不通过代码。

1 个答案:

答案 0 :(得分:1)

从网页链接到file:// URI充满了安全限制以及浏览器处理file:// URI的方式的差异 - 尤其是网络路径。

通过HTTP服务文件。