An URL to a Windows shared folder
Solution 1
I think there are two issues:
- You need to escape the slashes.
- Browser security.
Explanation:
-
I checked one of mine, I have the pattern:
<a href="file://///server01\fshare\dir1\dir2\dir3">useful link </a>
Please note that we ended up with 5 slashes after the protocol (
file:
) -
Firefox will try to prevent cross site scripting. My solution was to modify prefs.js in the profile directory. You will add two lines:
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess"); user_pref("capability.policy.localfilelinks.sites", "http://mysite.company.org");
Solution 2
File protocol URIs are like this
file://[HOST]/[PATH]
that's why you often see file URLs like this (3 slashes)
file:///c:\path\...
So if the host is server01
, you want
file://server01/folder/path....
This is according to the wikipedia page on file URI scheme and checks out with .NET's Uri.IsWellFormedUriString
method.
Solution 3
If you are allowed to go further then javascript/html facilities - I would use the apache web server to represent your directory listing via http.
If this solution is appropriate. these are the steps:
download apache hhtp server from one of the mirrors http://httpd.apache.org/download.cgi
unzip/install (if msi) it to the directory e.g C:\opt\Apache (the instruction is for windows)
map the network forlder as a local drive on windows (\server\folder to let's say drive H:)
open conf/httpd.conf file
-
make sure the next line is present and not commented
LoadModule autoindex_module modules/mod_autoindex.so
Add directory configuration
<Directory "H:/path">
Options +Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
7. Start the web server and make sure the directory listingof the remote folder is available by http. hit localhost/path
8. use a frame inside your web page to access the listing
What is missed: 1. you mignt need more fancy configuration for the host name, refer to Apache Web Server docs. Register the host name in DNS server
- the mapping to the network drive might not work, i did not check. As a posible resolution - host your web server on the same machine as smb server.
alex
Updated on July 09, 2022Comments
-
alex almost 2 years
Is there a way to incorporate a working link to a Windows shared folder into an HTML page? E.g. a link to
\\server\folder\path
?For simplicity, let's say the page will be opened on a Windows machine (and on the same intranet where the
server
is located, of course.)I've tried a few tricks with
file://
scheme, but none of them seemed to work. -
alex about 13 yearsYes, browser security is the issue. But I don't know if target browser is Firefox. Any other ideas?
-
alex about 13 yearsI think this won't work unless the HTML itself is loaded with
file://
URI scheme. At least it doesn't work with the WebKit-based Chrome. -
Bill about 13 yearsTake a look at the answer to a similar question, where IE should work, Firefox can be adjusted, but other major browsers block this. stackoverflow.com/questions/855614
-
StanLe3 about 6 yearsDo I need to configure browser's settings first? Cheers!