title: How do you open a file folder through a link on website in Firefox and Chrome?
body: <p>I'm working on a web application that needs to have a link which opens a documents folder from a file server. The folder can be opened either in a new browser tab or new window, or using the computer's default file browser program (i.e. Windows Explorer). This javascript should do the trick:</p>
  
  <p><code>window.open('file://///fileserver.companyname/public/Documents/','_blank);</code> </p>
  
  <p>and this html should also work: </p>
  
  <p><code>&lt;a href="file://///fileserver.companyname/public/Documents/"&gt;Open Documents&lt;/a&gt;</code> </p>
  
  <p>but these both only work in Internet Explorer, and our users always use Firefox and Chrome. Apparently the default security settings for Firefox and Chrome don't let you open a "file://" when the request is called from an "http://" website.</p>
  
  <p>I've seen several references to this page: <a href="http://kb.mozillazine.org/Firefox_:_Issues_:_Links_to_Local_Pages_Don%27t_Work" rel="nofollow noreferrer">Links to local pages do not work</a> which describes why you can't open files from webpages using Firefox and offers a few workarounds. Unfortunately, it only offers two options: install a plug-in on each browser instance, or create a user preferences file for each browser instance. Neither of these options are acceptable because we have too many users. The company I work for is not willing to apply anything to each machine which needs to access this link. Aside from that, I tried both plug-ins and the preferences file anyway, and the only one that worked for me was the IE Tab plug-in. I think the reason LocalLinks didn't work is because I'm trying to open a folder, not a file.</p>
  
  <p>This stackoverflow question described similar options for Chrome: <a href="https://stackoverflow.com/questions/2087894/can-google-chrome-open-local-links">Can Google Chrome open local links?</a> but again, the LocalLinks plug-in didn't work for me and plug-ins aren't acceptable anyway.</p>
  
  <p>I also found a website that suggested to use a command line argument top open files in Chrome (<a href="http://www.askyb.com/chrome/open-local-file-in-google-chrome/" rel="nofollow noreferrer">http://www.askyb.com/chrome/open-local-file-in-google-chrome/</a>) and one that showed how to apply the argument automatically (<a href="https://askubuntu.com/questions/160245/making-google-chrome-option-allow-file-access-from-files-permanent">https://askubuntu.com/questions/160245/making-google-chrome-option-allow-file-access-from-files-permanent</a>), but if I read it correctly it still involves applying changes to every computer accessing our website.</p>
  
  <p>Is there <em>any</em> way to <strong>open a file folder</strong> in both <strong>Firefox and Chrome</strong> entirely <strong>programmatically</strong> i.e. within my web application C# or Javascript code without installing a plug-in or adding a preferences file to individual computers? I cannot alter any of these business requirements. </p>
  
  <p><em>Sidenote</em>: We are using C# with MVC 4. I would prefer to open the folder using a Controller Action in C# (because I'd like to create the folder before opening it if it doesn't exist yet), but javascript or html on the client side is acceptable. For Internet Explorer, I can create that javascript in the C# code by wrapping it in the JavaScript( ... ) function built into MVC C# Controllers. When testing IE Tabs in Firefox and Chrome, I had to define it as an href link, not a function that opens a window, or IE Tabs wouldn't recognize it as a link. But neither of these were acceptable workarounds for our business needs.</p>