如何在浏览器中打开本地文件 [英] How to open local file in browser

查看:324
本文介绍了如何在浏览器中打开本地文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

网站有标签,其中href是本地文件的路径。
例如,< a href =D:\test.txt>连结< / a>
这是行不通的。



如何做到这一点? :)它只能在IE中工作,其他浏览器不是必需的。

解决方案

在这里您需要使用文件协议链接HTML中的文件,例如,

 < a href =file:/// D:\test.txt > LINK< / A> 

由于安全设置,浏览器可能会或可能不会打开该文件。您可以点击右键并选择复制链接地址,然后将其粘贴到浏览器中。

Website has tag, where href is path to local file. For example, <a href="D:\test.txt">Link</a>. It doesn't work.

How to do it right? :) It must work in IE only, other browsers are not necessary

解决方案

Here you need to use a "file" protocol to link a file in the HTML like,

<a href="file:///D:\test.txt">Link</a>

The browser may or may not open the file due to the security setting. You can click the right button and choose "copy link address" and then paste it into the browser.

这篇关于如何在浏览器中打开本地文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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