Search code examples
javascriptnetwork-security

Open a network share folder in a chrome tab from JavaScript


I have following html/js code that opens a network share folder on button click.

<button id="demo" onclick="clicked()">Open The Network Share Folder</button>

<script>
  function clicked() {
    const url = "file://ns-van.company.net/files";
    window.open(url,'_blank');
  }
</script>

When I save the above code in a htm file and open it in Chrome on my local laptop. It works - network share is open in a new Chrome tab and I can see the list of files

enter image description here

However, if I deploy the above htm file to a server running on my local. When I click the button, nothing happens and Chrome console will show me following error:

Not allowed to load local resource: file://ns-van.company.net/files

My question is, is there any way , I can open a network share folder in a chrome tab, from JavaScript deployed on a website. just like I did with the code above on my local?


Solution

  • No.

    As the error message says, it is not allowed.