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.
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.
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>
You want to use the file:
scheme.
file://C|/myFolder/myfile.xls
Tried it, but link does not open a thing. Sorry, I could not put this as a comment. Please edit.
精彩评论