[Project_owners] Disabling downloads from within mozilla

Pete Collins pete at mozdev.org
Mon Dec 1 20:14:03 EST 2003


> I am trying to lock down mozilla so that I can use it as the web browser 
> on some public internet terminals.  I have been able to disable access 
> to nearly everything by editing the XUL files within comm.jar ( which is 
> one of the jar files located in /mozilla/chrome/).  However, I cannot 
> find a way of stopping mozilla from giving me a download dialog when I 
> click on a hyper link that points to a resource which is of a file type 
> that mozilla does not understand eg: .exe, .gz, .tgz, etc
> To make matters worse I cannot disable the ability to hold down shift 
> and left mouse click on any hyperlink which then also gives you the 
> download dialog.  I need to disable both of these features as I do not 
> want users getting any sort of access to the file system.  Is there any 
> way I can do this?

You can certainly do this and from js code.

For example in the the method "onStateChange"

 
http://lxr.mozilla.org/seamonkey/source/xpfe/browser/resources/content/nsBrowserStatusHandler.js#172

is a good point to intercept the request, sniff out specific extensions 
or the content-type of the url and stop the request dead in it's tracks 
if it fails to pass your inspection using:

   aRequest.cancel(Components.results.NS_ERROR_ABORT);

This is even possible from a plugin or add on to the browser but since 
you are making a kiosk, you can edit the files directly.

As for the key bindings. i'm sure there is a way from xul to stop them. 
But the above suggestion may addresss this issue as well since I think 
all http link request marshalling passes through this function.

Hope this helps.

Regards

--pete

-- 
Pete Collins
www.mozdev.org
www.mozdevgroup.com



More information about the Project_owners mailing list