0

I asked this question earlier but there was a typo in my post -not my code as the moderators (correctly) believed. I'm asking this again because the code appears correct.

I'm using php to build a link to files on our network drives. The link appears fine:

<a href="file://///192.168.0.199/public/data/thefolder/ineed/100000-100999/K100212">100212</a>

If I click on the link in the browser, it doesn't work -nothing happens, no error etc..

If I cut and paste the following out of the page source and paste it into the address the browser opens it right up.

file://///192.168.0.199/public/data/thefolder/ineed/100000-100999/K100212

I've tried it in both Firefox and Chrome with the same results. I'm stumped. Thoughts?

Edit: I found out the link works in IE (v11) but it opens the directory in Windows Explorer instead of the browser as Firefox and Chrome do if I paste the link into the address bar. My first thought was some kind of browser security issue but why would it work when pasted into the browser address bar but not work when the link is clicked on?

Yes, there are a lot of slashes -it's a network drive and I'm drilling down in a tree. I didn't design it I just have to deal with it...

Thanks for your time.

So, as Olly points out below -Links that access local/network file systems are intentionally disabled in both in Firefox or Chrome due to security restrictions - though it seems odd that both Chrome and Firefox allow you to access the same path through the address bar?? More info can be found here: Linking a UNC / Network drive on an html page

Community
  • 1
  • 1
  • possible duplicate of [How can I create a link to a local file on a locally-run web page?](http://stackoverflow.com/questions/18246053/how-can-i-create-a-link-to-a-local-file-on-a-locally-run-web-page) – trizz Feb 26 '14 at 12:14
  • trizz -that link/question relates to a local file. It does not apply to remote files located on a network drive. – user3352918 Feb 26 '14 at 14:30
  • does the network drive have a hostname? have you read up on the [file URI scheme](http://en.wikipedia.org/wiki/File_URI_scheme)? the third `/` should designate network hostname, it will default to `localhost` if not – Ennui Feb 26 '14 at 15:01
  • I think ie is the only browser that has "explorer" functions.. It's the same with FTP, in ie you can edit/delete/add files but chrome and or ff/safari will be read-only – Miguel Stevens Feb 26 '14 at 15:04
  • 1
    From http://stackoverflow.com/a/2177136/13019: "Mozilla browsers refuse to follow file URLs on a page that it has fetched with the HTTP protocol." I assume the same is true for Chrome. I think it's down to the Same Origin Policy: https://developer.mozilla.org/en-US/docs/Same-origin_policy_for_file:_URIs – Olly Hodgson Feb 26 '14 at 17:24
  • Ennui FWIW I really thought you were on to something... Changing from an IP to a hostname didn't change anything. Both worked (or didn't) in the same manner. Thanks for the suggestion though. It was worth a try. For others, the link I provided does offer work-arounds (that do work in both Firefox and Chrome as of 26 Feb 2014) though I was hoping for something cleaner.. Thanks again all. – user3352918 Feb 27 '14 at 03:22

0 Answers0