Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


How to Clear Browser Cache in Javascript?

How to Clear Browser Cache in Javascript?

How to Clear Browser Cache in Javascript?

Hi everyone.

I've got a unique question. Is there a command or way to clear the browser cache onclick? I would like to apply a button on a test page that can clear browser cache from IE, Firefox, Netscape, etc.

Any assistance in this would be awesome. I suspect there is a way since in Javascript you can add bookmarks and other browser functions...


Web site design, internet marketing, SEO and business solutions company.

RE: How to Clear Browser Cache in Javascript?

No..  Due to security setting on the browser this is impossible.
Imagine how something like this can be abused.

M. Brooks

RE: How to Clear Browser Cache in Javascript?

You can probably do this in IE using the FileSystemObject to delete all the files in a specified folder, but that would assume that you know where every user who visits your site has their cache folder.

Other than that, I doubt this can be done.


Dan's Page @ Code Couch

RE: How to Clear Browser Cache in Javascript?

s0crates9, is your company IE only?
You could use ActiveX to clear out the folders and use system variables to determine the path to the temporary internet files folder for the current logged on user.  The ActiveX will cause warnings to the user though.

Paranoid?  ME??    Who wants to know????

RE: How to Clear Browser Cache in Javascript?

Perhaps searching Google for the information I gave in my first post ("FileSystemObject") would throw some results up..


Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page @ Code Couch

RE: How to Clear Browser Cache in Javascript?

You do not need to create the ActiveX controls only to use ones included with IE.  The FileSystemObject BillyRayPreachersSon mentioned above is one such object and exactly the one you need for accessing the file system of the local PC.  It gets invoked with a command like:
var fso = new ActiveXObject('Scripting.FileSystemObject');

Most of your examples for using FileSystemObject will be in VBScript but you can find some searching for Javascript and more searching for JScript.
Then you need to search for info on Windows environment variables.  I do not know if there is one specifically for the Temporary Internet Files folder but something like %APPDATA% get's you close in  Win 2000 system.  From there you have to back up one folder then go into Local Settings/Temporary Internet Files.  There may be other more direct variables and what you use may depend on what version OS you are dealing with.

Paranoid?  ME??    Who wants to know????

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close