Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox Links to local or network pages do not work

I have a .asp application where image files (.PDF) are stored in a directory (fed by a copier/scanner). The created file names are stored in a database table. When a query is launched from the web page a link to the file is created. When clicked the image should be displayed. This functionality works 100% in Internet Explorer. No such luck in Firefox (and I have some Firefox users). The created hyperlink looks like this file://Server/Scanner/XYZ.pdf

The Firefox helps suggest the reason is this:

Links to local or network pages do not work. As a security precaution, Firefox forbids sites on the Internet to link to files that are stored in your local computing environment. These files may include files on your computer, mapped network drives, and UNC network paths

None of the suggestions for a workaround seem to work (or I am not understanding the steps to create the image display) Any Suggestions?

like image 548
Joe Avatar asked Oct 10 '08 16:10

Joe


People also ask

Why do links not work in Firefox?

Clear the Cache and remove the Cookies for websites that cause problems via the "3-bar" Firefox menu button (Options/Preferences). Start Firefox in Safe Mode to check if one of the extensions ("3-bar" menu button or Tools -> Add-ons -> Extensions) or if hardware acceleration is causing the problem.

How do I fix Firefox not loading pages?

Launch the Firefox browser, and go to the about:preferences#privacy page. Within that, select Standard Mode and click on the Reload All tabs button. When the tabs reload, try accessing the desired website and verify if the Firefox not loading pages issue has been fixed or not.

Why is Firefox not displaying web pages correctly?

Clear the cookies and cache If a website has updated their code, Firefox may still be using some of the old code along with some of the new, which can make a web page display incorrectly. To fix this, you need to clear the cookies and cache: Click the menu button. to open the menu panel.


2 Answers

This is the default Firefox behavior designed for security .The assumption is probably that most web sites don't know what and where are you local files (including UNC paths).

This could be turned off in firefox:

  • type "about:config" in the address bar and accept "i'll be careful"
  • find "security.checkloaduri" in older versions or "security.fileuri.strict_origin_policy" in newer versions of firefox and change the value to "false"
  • restart firefox

That should do it for you. You have more information here:

  • http://kb.mozillazine.org/Security.fileuri.strict_origin_policy
  • http://kb.mozillazine.org/Security.fileuri.origin_policy
like image 108
Marko Dumic Avatar answered Oct 07 '22 19:10

Marko Dumic


Firefox >= 68.0.1

I'm able to preview in Firefox both images and PDF files with local file links using the settings mentioned here: https://bugzilla.mozilla.org/show_bug.cgi?id=1303727

I have used links with local file: <a href="file://N:/path/to/file.ext">test</a>

and added in user.js the mentioned settings (with adjusted sites list):

user_pref("capability.policy.policynames", "localfilelinks"); user_pref("capability.policy.localfilelinks.sites", "http://my.intranet"); user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");

Also, when setting Firefox to "Always ask" for PDF files, I was able to "Open with" the PDF in Adobe Acrobat Reader DC, which reported the expected local folder when accessing "File -> Properties".


Firefox >= 1.5.x < 20 (ish)

Search for the Firefox profile folder on your hard drive, e.g. (12345678 stands for eight random digits and letters):

  • Windows: "C:\Documents and Settings\Username\Application Data\Mozilla\Firefox\Profiles12345678.default\"
  • Linux: "/home/username/.mozilla/firefox/12345678.default/"
  • OS X: /Username/Library/Application Support/Firefox/Profiles/12345678.default/

In this folder create a text file with the name user.js. Write the following line into that text file:

user_pref("capability.policy.default.checkloaduri.enabled", "allAccess");

Works on my PC (Firefox 3.0.3 and 19.0 beta) with the following references:

  • <img src="file://///server/share/image.png" />
  • <img src="file://\\\server\share\image.png" />
  • <img src="file://d:\image.png" />
  • <img src="file:///d:\image.png" />
  • <img src="file://d:/image.png" />
  • <img src="file:///d:/image.png" />
  • <img src="file://localhost/d:/image.png" />

Also, if you are using the NoScript add-on, check the Advanced \ Trusted \ Allow local links option.

like image 26
alexandrul Avatar answered Oct 07 '22 20:10

alexandrul