Search code examples
htmlgoogle-chromeinternet-explorerfirefoxhref

Open file on a local network using html a href "file:\\" Not allowed using link


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.


Solution

  • 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?