I am trying to display a document in the browser using a html link which has this form :
<a href="file://Serveur-clipper\path\file.pdf" target="_blank">filename.pdf</a>
I already tried to use file:// , file:/// , file:\\ , and file:\\\ , but I always have the same error :
Not allowed to load local resource: file://...etc
The strange thing is that it is working on one computer (with google chrome) when the extention "LocalLinks" is installed but not on the others computers (with the same extention installed).
It is working on all computers when I directly paste the file path in the URL, the only problem is when using the link to open it.
I don't understand the issue.
-
The protocol is file:// as http(s):// - never waste time with backslashes there. On unixoid systems, the root directory follows, which gives gives the third slash. On Windows - don't know, might depend on version, I believe it accepts forward slashes too, at least. So it would be file://C:\foo\bar.html or file:///home/gauthier/bar.htmluser unknown– user unknown2023年09月26日 19:02:21 +00:00Commented Sep 26, 2023 at 19:02
1 Answer 1
Your Best bet would be to store it in a folder relative to the served HTML file. Because different Web Browser's use different protocols.
Here are some other more in depth answers:
How can I create a link to a local file on a locally-run web page?
1 Comment
Explore related questions
See similar questions with these tags.