Search code examples
htmlhref

<a href="http://file://///> convert file:// to file// ---remove colon


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?


Solution

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