5

This Java code,

"<a href='file:///" + curBP.get_build_path() + "'>" + curBP.get_build_path() + "</a>"

is outputted to the browser.

On the page, the HTML is:

<a href="file:///\\path\to\shared\file">Shared File</a>

However, it does not open the file. I've tried countless other combinations of slashes, but to no avail. In FireFox, it acts like a dead link and does not open the file. In IE, it works.

Any idea as to how to make it work in FireFox? Thanks!

Garrett
  • 11,451
  • 19
  • 85
  • 126
  • Perhaps because the web, unlike windows, uses *forward* slashes? –  Jan 21 '11 at 21:14
  • That doesn't apply to windows/local paths, does it. file:// expects a 'regular' file path. – GolezTrol Jan 21 '11 at 21:21
  • @GolezTrol: When I view a local file on windows in firefox, the URL has forward slashes and everything works fine. –  Jan 21 '11 at 21:22
  • Could be. Might be a decision in the cross platform implementation. Doesn't matter after all, because Windows accepts forward slashes in file paths too. Still doesn't make sense. A local file is a local file, so it should follow local file naming conventions. There's no reason it should follow domain name conventions. – GolezTrol Jan 21 '11 at 21:26
  • @GoeluTrol: First and foremost, it's an URI. An URI using the file protocol and therefore corresponding to a file path, but still an URI. And URIs use forward slashes. –  Jan 23 '11 at 15:17

2 Answers2

7

Bad news: Firefox has closed a security hole:

http://www.techlifeweb.com/firefox/2006/07/how-to-open-file-links-in-firefox-15.html

It requires the user to modify a local file to allow file:// urls.

Chris B. Behrens
  • 6,255
  • 8
  • 45
  • 71
1

When you use backslashes {} , you're calling Windows Explorer. And IE is integrated with Windows Explorer, FF not integrated

Eray
  • 7,038
  • 16
  • 70
  • 120