1

I need to open filelink (network share in local) in the browser.

I use such code:

<a href="http://file://///server/localfolder"> 

It open link in the browser but convert it to such format: file/////server/localfolder (remove colon).

This way browser don't open local folder. I have tried to change file:///// to file:// or file:/// or file://// . But colon stell removed by browser.

How to solve it?

BenM
  • 52,573
  • 26
  • 113
  • 168

1 Answers1

0

You can't specify more than one protocol definition as part of a URL schema. You shouldn't link to file:// either, really, but if you absolutely must, just remove the http:// definition as follows:

<a href="file:///server/localfolder"> 

You can read more about file: protocol, and in particular its implementation in the following links:

Community
  • 1
  • 1
BenM
  • 52,573
  • 26
  • 113
  • 168
  • BenM, thank you for your comment. If I remove the http:// it doesn't open a link at all by pressing at it. Only right click, copy link and paste in the browser. –  Apr 27 '16 at 08:44
  • Yes, file:///. Doesn't work. Link is correct but no way to open by pressing it. –  Apr 27 '16 at 08:47
  • @inno.vlad Try it with 5 slashes, or just read through the question marked as duplicate by Quentin. – BenM Apr 27 '16 at 08:48
  • But it doesn't work with 5 slashes too. The solution in duplicated question is from 2013 y., probably something has changed. It doesn't work. Really. –  Apr 27 '16 at 08:51
  • @inno.vlad 1. What browser are you using? 2. Why does the date matter? It's a definition of a URL scheme, those things don't change, they're implemented differently in different browsers, though. 3. How do you mean 'doesn't work'? You're not able to click the link, you get a 404, or something else? Do you have any JS preventing click on the element? – BenM Apr 27 '16 at 08:52
  • Browser - JS and Chrome. Link exist and user able to press it but nothing has happen. goo.gl/UeP6uC –  Apr 27 '16 at 08:59
  • Check your error console. – BenM Apr 27 '16 at 08:59
  • Not allowed to load local resource: –  Apr 27 '16 at 09:00
  • http://stackoverflow.com/questions/23969953/not-allowed-to-load-local-resource-file-c-jpg-java-ee-tomcat – BenM Apr 27 '16 at 09:01
  • Yes, I see. Probably security issue. Thank you, BenM. Good luck and good day to you. –  Apr 27 '16 at 09:03
  • @inno.vlad No problem. If the answer helped, you may want to mark it as solved :) – BenM Apr 27 '16 at 09:04