Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to disable file:// protocol in firefox

I want the users not to browse the local files on the machine.

I already disabled SaveAs and OpenFile functions.

I want user not to browse the local files or open it if he know the full path.

share|improve this question

migrated from stackoverflow.com Aug 27 '09 at 1:16

This question came from our site for professional and enthusiast programmers.

1  
Remember to disable Help, too. Sometimes Help opens backdoors. – tsilb Aug 26 '09 at 23:30

University of Waterloo has a page detailing a change to browser.js to disable file, chrome, about, etc. protocols.

That was the first result on Google for "firefox disable file protocol," by the way -- probably would have been the first one if this question wasn't the first result.

share|improve this answer
    
I already visited this site and the code provided by them is: if (location.match(/^file:/) || location.match(/^\//) || location.match(/^chrome:/) || location.match(/^resource:/) || (!location.match(/^about:blank/) && location.match(/^about:/))) { loadURI("about:blank"); } I found in other sites that to put this code in BrowserLoadURI function which is not found in ff3.x – Ammroff Aug 27 '09 at 0:28
3  
The page suggests a blacklist, I'd go for a whitelist instead. "http" and "https", and perhaps "ftp" ought to be enough. – Juliano Aug 27 '09 at 1:31
up vote 3 down vote accepted

I found a way to do this.

First the scenario of our problem is:

  • We want client to use a PCs and they have access to firefox only
  • No "my computer","cmd",...etc.
  • We want them not to browse local files by Firefox , just browsing some sites.
  • We want to block file:// protocol that cause browsing of local files.

My suggested solution:

  1. Download r-kiosk extension and modify it to run on firefox 3.5.*

  2. Modify userPref.js to show the address bar in firefox ---- here we stop Save as,open file,remove extension,no viewsource,but users still browse the localfiles by typing file:///c:/ in url.

  3. Modify dirListing.css in Firefox/chrome/classic.jar/skin/classic/(skin name)/dirListing

    body{
               ...
               background-image:url(chrome://global/skin/dirListing/forbidden.png)
        }
    table{
    ...
    display:none;
    }
    

Hide elements like P,H1 by using visiblity:hidden

You can use this image created by me to make it as body background:

alt text

Here is the result:

link text

share|improve this answer
    
Shouldn't "r-kisok" (in bold, in like "1." above) be r-kiosk? – Argalatyr Aug 28 '09 at 0:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .