The easiest way to go on Windows is, assuming your browser has Javascript enabled, like this:
JS: if (navigator.userAgent.indexOf('Windows')!=-1) { document.getElementById('objDiv').innerHTML='SMB location '; }
I assume you have eg. a DIV tag with id=objDiv. Notice that, although modern browsers like Chrome, Firefox, IE 11, Opera (does anyone still use it ?) will prevent you from navigating from "non-FILE:/// URIs" like HTTP, HTTPS to a "file:///" based URI, you could try writing the URL to the page if you cannot access it, (you could try window.location and upon error, write to the page and ask the user to copy the URL and paste it into the address bar of his browser). Advantage: you dont need to ask for installation of anything. Disadvantage: users will always have to copy and paste stuff on the browser address bar.
Registering the SMB:// URL Protocol is ok, but the script provided by our friend assumes you have 'Administrator' level access, and every time you try to reference this protocol, the browser will prompt (unless of course you change settings to it wont ask about this particular protocol.).
A workaround to the REG script is, to replace :
HKCR with HKCU\Software\Classes ...the 'PATH' environment variable for the current user (which doesnt require Administrator access to change) is located at : HKCU\Environment in Windows Registry. (you edit the 'path' REG_SZ or REG_EXPAND_SZ value.)
If you have 'Administrator' access, you can right-click the batch script provided (.bat or .cmd files) and then select the "Run As Administrator" menu option...this is translated (localized) for different languages, but the easiest way to know this menu option is to look at the icon of a shield, on the left side of the option. Advantages: user wont need to copy and paste stuff all the time... Disadvantages: Users will have to install stuff. Also, URL Protocol might contain vulnerabilities, including but not limited to browser security bypass allowing them from being invoked automatically or code/argument injections which could lead to a mess, system compromise, etc.
Note: Successfully tested on Chrome, Firefox and IE 11. Edge doesnt seem to support at all network paths (local paths ok, but again you cannot navigate from remote locations to local folders or files)
hope this further helps and clarifies ;)
2
[so] dupe: How do I register a custom URL protocol in Windows?
– DavidPostill – 2016-04-11T16:56:15.270[so] dupe: how do I create my own URL protocol? (e.g. so://…) – DavidPostill – 2016-04-11T16:57:05.977
1
MSDN: Registering an Application to a URI Scheme
– DavidPostill – 2016-04-11T16:59:17.0831Note: The Windows way assumes that 1.2.3.4 is mounted as X:. The more reliable way to do it is \1.2.3.4. – Duncan X Simpson – 2016-04-11T19:31:07.753