local file:// links in chrome or edge
N

3

8

Having file:// links within a website e.g. http://localhost will not open because of security reason.

In IE and Firefox it's possible to allow such access either in the "Trusted Sites" & "Local Intranet" from IE or to configure a policy in Firefox:

enter image description here

I can't figure out a way in Chrome or Edge.
Searching the web I came across solutions like the --allow-file-access-from-files flag, but that does not work in Chrome 77.0.
Also there are some extensions which enable that behavior: Enable local file links

I believe there must be some similar way with policies like in Firefox?

EDIT: update 22.03.2021

Chrome Version 89.0.4389.90
Edge Version 89.0.774.57

Result:

Not allowed to load local resource: file:///D:/temp/demo.pdf

Demo HTML:

<html>
<body>
    <a href="file://fileserver/demo.pdf">file://fileserver/demo.pdf</a><br/>
    <a href="file:///d:/temp/demo.pdf">file:///d:/temp/demo.pdf</a> extra slash according to https://en.wikipedia.org/wiki/File_URI_scheme
</body>
</html>
Neuropsychiatry answered 29/10, 2019 at 12:43 Comment(0)
C
3

[Update 2022]
As mentioned by flavio.donze, since Edge v95 there is a new policy:

Allow intranet zone file URL links from Microsoft Edge to open in Windows File Explorer

If you enable this policy, intranet zone file URL links originating from intranet zone HTTPS pages will open Windows File Explorer for that file or directory.

So to get this to work, you have to use HTTPS and specify the site as a site being in the intranet zone.

[Outdated - old answer]
Yes, there is a similar policy in Edge (v88 or later), but it only works in conjunction with IEMode:

When a file:// URL is requested to launch in Internet Explorer mode, the file extension of the URL must be present in this list in order for the URL to be allowed to launch in Internet Explorer mode. A URL which is blocked from opening in Internet Explorer mode will instead open in Edge mode.

This policy controls the visibility of the 'Open link in new Internet Explorer mode tab' option on the context menu for file:// links.

[Other browsers]
The alternatives are, as you already stated above in your question:

Cheyney answered 23/8, 2021 at 9:9 Comment(2)
This will help in some environments, thanks for your answer.Neuropsychiatry
Glad it helps a bit. If you think this fits your question, it would be cool if you mark it as answer 😉Cheyney
N
0

There is a new GPO introduced in Edge 95: IntranetFileLinksEnabled

But as stated here, it might only solve the problem for some scenarios:
edge policy IntranetFileLinksEnabled enabled does not open file

Because only the windows-explorer is opened and not the actual file: enter image description here

<a href="file://power/share/demo.txt">file://power/share/demo.txt</a><br/>
<a href="file://power/share/demo.docx">file://power/share/demo.docx</a><br/>
<a href="file://power/share/demo.pdf">file://power/share/demo.pdf</a><br/>
<a href="file://power/share/demo.html">file://power/share/demo.html</a><br/>

This setting allows file URL links to intranet zone files from intranet zone HTTPS websites to open Windows File Explorer for that file or directory.

If you enable this policy, intranet zone file URL links originating from intranet zone HTTPS pages will open Windows File Explorer for that file or directory.

If you disable or don't configure this policy, file URL links will not open.

Neuropsychiatry answered 15/12, 2021 at 13:29 Comment(0)
T
0

I solved this problem on Edge by installing the "Enable local file links" extension and checking "Allow access to file URLs" when I first used it.

Here's a link to the extension in the Chrome Web Store: https://chromewebstore.google.com/detail/enable-local-file-links/nikfmfgobenbhmocjaaboihbeocackld

The extension seems to work fine on Edge.

Tadeas answered 22/5 at 9:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.