Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9216799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:29:36+00:00 2026-06-18T02:29:36+00:00

how to clear browser cache and history via javascript I found some links like:-

  • 0

how to clear browser cache and history via javascript
I found some links like:-

How to clear browser history oan clear cache?

how to clear browser hash history in javascript

but they do not properly described on how this can be achieved via javascript ( or jQuery)

I require this so that the user do not have to do a [Ctrl+F5] or manually clear cache
and the most recent version of javascript file is loaded in the browser.

The main aim is to load the latest javascript files every time the user visits the website.
My application in ASP.NET MVC based and javascript files are included in .csHtml file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:29:38+00:00Added an answer on June 18, 2026 at 2:29 am

    There are other ways to prevent a JavaScript file (or other files) from being cached.

    Simply append some dummy parameters to the end of the url. For example –

    http://www.yourCoolSite.com/resources/js/main.js?r=SOME_RANDOM_VALUE
    

    You would optimally do this on the server side. In PHP, this would look something like this –

    echo "http://www.yourCoolSite.com/resources/js/main.js?r=".time();
    

    Using the time() function, we append the current epoch timestamp to the URL and therefore guarantee* that the file will appear different to the browser each time.

    * Until 2038 that is 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to clear browser cache with php?
Can I clear browser cache of the page when I'm leaving it. // Clear
Hi I need to clear IE8 browser cache before loading my cd-based php application.
How can I clear or refresh the page in the browser using javascript? I
I would like to create a rake task or something to clear the browser
How can I clear browser cache only on logout, sure I can use the
Im trying to clear the browser cache when the page is loaded and/or prevent
Many times we clear user browser cache when a user open our website or
If I am on a flash heavy website, and I clear my browser cache,
Possible Duplicate: How to clear browser cache with php? I have created a web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.