1

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.

asked Dec 9, 2015 at 13:43
1
  • 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.html Commented Sep 26, 2023 at 19:02

1 Answer 1

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?

answered Dec 9, 2015 at 13:53
Sign up to request clarification or add additional context in comments.

1 Comment

I can't do that because the file has to be read by more than 50 computers. I can't copy them on all the machines. Thanks for the link, I already read this ressource but it doesn't help that much. Thanks anyway

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.