搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

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 有這個問題
  • 12 次檢視
  • 最近回覆由 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.