当前位置: 动力学知识库 > 问答 > 编程问答 >

windows - firefox open local link to directory with explorer

问题描述:

On a Website for our internal use i show links to local files and folders. the links are like this:

href="file://C:/example/"

href="file://C:/example/test.odt"

The Problem is now that the link to the directory does open in firefox itself with a useless directory listing. Useless because you can just see the files or open them but not copy, insert, delete...

The link to the file work normal and the file is opend by OpenOffice.

By changing the configuration of firefox and setting the following key to false I can open the directory in with explorer.exe but for the file I have to choose the right application.

network.protocol-handler.expose.file

Does someone know a way to get both to work like i want? Means that the Directory is shown by explorer.exe and all files are opened by the right application.

This can be by configuring Firefox or windows, changing the links, or even by writing a small program which opens all the file protocol correctly and will be used as protocol handler for the file protocol in firefox.

Thanks

Raffael

网友答案:

I did the above with small changes in Firefox 14.0.1, which works for me:

  1. Create new boolean value network.protocol-handler.expose.file and set it to false
  2. Create new boolean value network.protocol-handler.external.file and set it to true
  3. Click on a link to a local folder.
  4. In the following prompt, link to the explorer.exe in: C:\Windows\explorer.exe

Files are now open with the default application, folders are open with the Windows Explorer!

网友答案:

I know this is not quite what you want, but you might take a look at the "launchy" addon for firefox:

https://addons.mozilla.org/en-US/firefox/addon/81/

Using this addon you can right click on a file link, go to "launchy" sub-menu, and tell it to open in explorer. This will browse directly to the folder as you want.

I want the same feature you want, however this "works" for now. I have asked the author of launchy to allow it to override the left-click behavior for certain protocols (so it would launch explorer with one click), but I don't have a response yet.

edit: Years later, I will post the solution I started using instead of Launchy:

https://addons.mozilla.org/en-us/firefox/addon/local-filesystem-links/

https://github.com/feinstaub/firefox_addon_local_filesystem_links

This scans for file:// links and makes them clickable. It does inject some HTML which can mess with formatting if you aren't careful, but it does the job.

网友答案:

In about:config You need to add a boolean value with the name network.protocol-handler.expose.file and set it to false and also create a string value with the name capability.policy.default.checkloaduri.enabled and set it to allAccess.

Now you will be able to choose C:\Windows\explorer.exe to open file links.

Tested in FF 19.0.2 in Windows 7.

网友答案:

Try this: Create new boolean value with the name network.protocol-handler.expose.file and set it to false

Create new boolean value with the name network.protocol-handler.external.file and set it to true

Open link to a local directory and on the now appearing box, register the "file"-protocol permanently with the "file"-programm (1st entry). There should now open the windows explorer. You can deassociate the type "file" in the Firefox-settings (applications-tab).

After that, a link to a document (i.e. file:///x:\dir\file.doc) worked automatically for me (FF8.0).

分享给朋友:
您可能感兴趣的文章:
随机阅读: