link to local disk

早过忘川 提交于 2019-12-13 02:15:33

问题


Is it possible to put a html link on a page that opens a file in local disk?

Like c:/myFolder/myfile.xls

This page is not actually going to be on web, but this feature would be needed for demostration purposes only. When the page is on web, the file is too, and link has url value.


回答1:


You could use

<a href="c:/myFolder/myfile.xls">my link</a>

Be wary that this may not work for all browsers (ie firefox) due to security reasons (See here) and it certainly wont work for other people accessing the webpage.




回答2:


This would be a risky thing to do. As not everybody uses a PC, it will be different for a mac and a linux than a PC. Also not all browsers allow you to do it, such as Firefox, it dis-allows it due to potential security risks. But anyway here's the html code if you still wish to do it:

<a href="file:///C:/myFolder/myfile.xls">Click Here</a>



回答3:


You want to use the file: scheme.

file://C|/myFolder/myfile.xls



回答4:


Tried it, but link does not open a thing. Sorry, I could not put this as a comment. Please edit.



来源:https://stackoverflow.com/questions/4312661/link-to-local-disk

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