搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Anyone else have a problem with a dash '-' in a file:// link not working in FireFox (works in I.E.) when clicked upon?

  • 4 个回答
  • 1 人有此问题
  • 3 次查看
  • 最后回复者为 ugarmozilla

more options

ex. file:///\\svr-1\folder1\folder2\file.jpg

A file URL like this will work when typed/pasted in the Address bar of FireFox, however, if it is a link in a webpage, it will be non-responsive. If something like this happens to be a link in an email in an email program, where that email program is set to open links in the default browser (and it's Firefox), then Firefox will open a window/tab with the following URL:

file://///folder1/folder2/file.jpg

Where the directory with the '-' and all parent directories preceding it are removed.

The example above is actually a network file link, but I've noticed the same if the dash is in the file name or sub folder of a network file link.

ex. file:///\\svr-1\folder1\folder2\file.jpg A file URL like this will work when typed/pasted in the Address bar of FireFox, however, if it is a link in a webpage, it will be non-responsive. If something like this happens to be a link in an email in an email program, where that email program is set to open links in the default browser (and it's Firefox), then Firefox will open a window/tab with the following URL: file://///folder1/folder2/file.jpg Where the directory with the '-' and all parent directories preceding it are removed. The example above is actually a network file link, but I've noticed the same if the dash is in the file name or sub folder of a network file link.

被采纳的解决方案

You should probably see a security warning in the Tools > Error Console because Firefox doesn't allow web pages to access local files.

This one one is the correct specification.
You need 5 slashes: two for the file protocol, one for the root and two for the server:

file://////svr-1/folder1/folder2/file.jpg
file:///folder1/folder2/file.jpg


定位到答案原位置 👍 0

所有回复 (4)

more options

Use forward slashes instead of backslashes.

more options

Thank you for replying cor-el.

You actually brought up a good point I forgot to mention.

I tried using forward slashes and other variations in the same manner, and they all didn't work in Firefox, but worked in Chrome and I.E.

Taking the example:

   file:///\\svr-1\folder1\folder2\file.jpg 

I also tried:

   file://///svr-1\folder1\folder2\file.jpg 
   file://///svr-1/folder1/folder2/file.jpg 
   file://svr-1\folder1\folder2\file.jpg 
   file://svr-1/folder1/folder2/file.jpg 

These links didn't work embedded in an email or on a webpage. For the case of the webpage, when the mouse cursor is hovering over the links, the jump bar indicates the correct link, but when clicked, nothing happens. When the links are copied and pasted into the address bar, they work.

Thanks again.

more options

选择的解决方案

You should probably see a security warning in the Tools > Error Console because Firefox doesn't allow web pages to access local files.

This one one is the correct specification.
You need 5 slashes: two for the file protocol, one for the root and two for the server:

file://////svr-1/folder1/folder2/file.jpg
file:///folder1/folder2/file.jpg


more options

Thank you again for replying cor-el.

I'm aware of the correct specification for the file protocol, I was just testing other known ways that work using the file protocol to see if that was the issue. :-P

You are correct regarding the Error Console.

It looks like everything I've stated is pretty much summed up in the following "bug":

https://bugzilla.mozilla.org/show_bug.cgi?id=122022

And I agree with the comments in there about making the current behavior by Firefox as an option. I personally wouldn't mind having warning messages for such links.