views:

281

answers:

2

I have a web application running in a kiosk, which is set up with greasemonkey so that we can customize little things about the application and ensure the customizations only occur at the kiosk. I have been digging through the GM api hoping that it would have some functionality to affect browser settings, but alas it looks like it only affects pages running in the browser. Is there a way for me to tell the browser to clear it's cache when a certain event happens in the application?

A: 

You might have a look at the 'Clear Cache Button' - Firefox-Addon.
Download (not install) the extension, extract it (with 7zip, WinRar, WinZip, WinAce, ...) and have a look at the code executed onclick. The same should work as Greasemonkey Script.

Don't forget to add a note to the originaly author if you just copy-paste his solution!

~Chris

cimnine
I get a permissions error when I try to do this...
W_P
A: 

Ordinary javascript does not have permission to do this, it apparently would be a security hole.

GM javascript also does not have sufficient privileges. Firefox extensions operate with elevated privileges, which is why that add-on can clear the cache.

Some options:

  1. If you make your own Firefox extension, starting with that 'Clear Cache Button' one, it can probably clear the cache on some kind of events and/or timer.

  2. JavaScript can reload the page, and specify that the cache not be used: window.location.reload(true).

  3. You can set up a cron job, or Windows Scheduled Task, to kill the firefox task, once per day, run something like CCleaner, then restart Firefox.

    This is probably a good idea anyway, as Firefox tends to bog down and hog memory, if left running too long. Similarly, you might consider restarting the whole computer and cleaning up on every restart.

Brock Adams