Forum Discussion
How the new Edge will handle file:// URI ?
Thanks narutards
For anyone else interested, we changed all our file:// link references to localfile:// and implemented a new protocol handler in the registry.
For example:
localfile://open?data=\\NASORL1\EngData\MAVIS\ProjectTickets\13092\Engineering-Data\Prototype\
Since this issue only applies to our intranet web application that we've developed internally, it was an easy thing to deploy (you might be able to do it via group policy if you're running AD or via an easy EXE to make those if not).
Also, since this is a registry edit, the protocol will be recognized on any browser.
That's our work-around for now.
JeffOwens +1 ! This is what we have done finally. We just had to implement a new URI Scheme handler to mimic what we had in IE11. It works with all modern browsers.
If anybody want directions, please tell me. (Note: I'm the guy who posted the initial subject - I'm working for another company now).
Best regards JeffOwens.
- SoumyaRajuMar 02, 2021Copper Contributor
sylvainrodrigue - Could you please your solution?
- MartyMillerMar 03, 2021Copper Contributor
SoumyaRaju Here's what I did...
addLocalMyFile.reg:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Myfile]
@="URL:My Local File Protocol"
"URL Protocol"=""[HKEY_CLASSES_ROOT\Myfile\shell]
[HKEY_CLASSES_ROOT\Myfile\shell\open]
[HKEY_CLASSES_ROOT\Myfile\shell\open\command]
@="powershell.exe -Command \"$val='%1'; $val = $val.Substring(10, $val.length - 10).TrimEnd('/').Replace('/','\\'); & 'EXPLORER.EXE' $val\""Apply the above registry change to each client machine. Then, instead of...
lb.Attributes.Add("onclick", "javascript:window.location.href= 'file:///" & fileToOpen2 & "'; return false;")
Do this...
lb.Attributes.Add("onclick", "javascript:window.location.href= 'Myfile://" & fileToOpen & "'; return false;")
- KaseebhotlaAug 17, 2021Copper ContributorMarty, I tried this. It's succeeding in opening explorer.exe but the file itself is not being opened. What does %1 hold when assigned to $val? Is it the entire URL? If yes, shouldn't the substring only exclude the first 7 characters ("myfile:")? Thank you!
- SoumyaRajuMar 01, 2021Copper ContributorCould you please share how you implemented the URI Scheme handler?
- dbeuscherSep 03, 2020Copper Contributor
Yes, I am definitely interested in the instructions for this! Please post?sylvainrodrigue
- jaynec89Aug 27, 2020Copper Contributor
sylvainrodrigue me please!
- navijayvargiyaMay 11, 2020Copper Contributor
Can you please provide more detail, how you have created this uri protocol handler and registered it?
I have created similar handler and registered it but my browser is not detecting this new uri scheme.
How can we debug whether this protocol handler is working or not? I have created it using .net console application.
How can register this handler using group policy?
Thanks in advance
- rakova17May 04, 2020Copper Contributor
sylvainrodrigue Would you be able to share the instructions? Thanks!
- jpochedleyMay 04, 2020Brass Contributor
I know it may not be what 100% of people want / need, but this helped us since most of the items we were linking to were Office docs (not file folders, etc)...
Check out the Office URI scheme, as documented here:
https://docs.microsoft.com/en-us/office/client-developer/office-uri-schemes
When using the Office URI, the file open method uses the Office protocol handlers which support the file:// URI .... so, a HREF on a web page can point to ms-word:ofv|u|file://<server_path_to_doc> and Word will open the file directly from a non-http path...
HTH
- aspeagle69Sep 30, 2021Copper ContributorThank you! This was the perfect answer for most of our documents. I still haven't found a way to display the pdf docs though. I may just have those uploaded since they are view-only. Thanks again!
- ScreamBEApr 28, 2020Copper Contributor
sylvainrodrigue hi, I'm interested too.
- Mar 30, 2021
You can use EdgeView2 control in which you can map local directory to virtual one using SetVirtualHostNameToFolderMapping function.
webView2.CoreWebView2.SetVirtualHostNameToFolderMapping("my.virtual", "@"C:\MyVirtual\", CoreWebView2HostResourceAccessKind.Allow);After that you can use this syntax to access your file
"https://my.virtual/" + "myFile.txt"- rakova17Mar 30, 2021Copper Contributor
MichelLAPLANE can you elaborate or explain like I'm 5? Thanks!
- ThiloLangbeinApr 28, 2020Brass Contributor
ScreamBE We instruct our users to not use file-links anymore, because they are not future-proof. I will not install/maintain/support "dirty" extensions to make this work again.
- Toto67Apr 24, 2020Copper Contributor
sylvainrodrigue Yes to directions, please

- jpochedleyApr 20, 2020Brass Contributor
sylvainrodrigue Yes, please.