Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open local file from browser?

Tags:

html

file

macos

I'm using the following when trying to open a local file:

<a href="file:///Users/username/Dropbox/Documents/a/some document.numbers">some document</a>

When I click the above in a browser, it opens Finder to the folder. But does not open the file. Should I be doing something else to have the file open in Numbers?

like image 578
4thSpace Avatar asked Sep 26 '17 15:09

4thSpace


People also ask

How do I open a file from browser?

Press the Ctrl + O hotkey Pressing that hotkey will open an Open window. Select a supported file format to open in the browser from that window, and click the Open button.


2 Answers

You cannot open local files on the client. This would be a huge security risk.

You can link to files on your server (like you did) or you can ask the client for a file using <input type="file">

like image 57
SourceOverflow Avatar answered Oct 19 '22 19:10

SourceOverflow


You can only open some types of files in browsers, like html css js and mp4, otherwise the browser will want to download it. Also remember that browsers replace spaces with %20. I recommend right clicking the file and opening it with chrome then copy that link and using it.

You can open files that are local as long as it is a file that is on the file that is trying to open another file is local.

like image 4
DrBrad Avatar answered Oct 19 '22 19:10

DrBrad