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

  • SEARCH
  • Home
  • 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 7488233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T14:48:48+00:00 2026-05-29T14:48:48+00:00

Is there a way in either Javascript or C# to tell if the browser

  • 0

Is there a way in either Javascript or C# to tell if the browser that someone is using has disabled caching of static content?

I need to be able to test whether or not the browser is optimized for caching.

  • 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-05-29T14:48:51+00:00Added an answer on May 29, 2026 at 2:48 pm

    UPDATE

    I did a bit more investigation of the problem and you can find more detailed answer in my recent post
    Note, the solution described below (initially) is not cross browser solution.

    Not sure if it helps, but you can try the following trick:
    1. Add some resource to you page, let’s say it will be javascript file cachedetect.js.
    2. The server should generate cachedetect.js each time someone request it. And it should contain cache-related headers in response, i.e. if browser’s cache is enabled the resource should be cached for long time. Each cachedetect.js should look like this:

    var version = [incrementally generated number here];
    var cacheEnabled; //will contain the result of our check
    var cloneCallback;//function which will compare versions from two javascript files
    
    function isCacheEnabled(){
       if(!window.cloneCallback){
           var currentVersion = version;//cache current version of the file
           // request the same cachedetect.js by adding <script> tag dynamically to <header>
           var head = document.getElementsByTagName("head")[0];
           var script = document.createElement('script');
           script.type = 'text/javascript';
           script.src = "cachedetect.js";
           // newly loaded cachedetect.js will execute the same function isCacheEnabled, so we need to prevent it from loading the script for third time by checking for cloneCallback existence       
           cloneCallback = function(){
               // once file will be loaded, version variable will contain different from currentVersion value in case when cache is disabled 
               window.cacheEnabled = currentVersion == window.version;        
           };      
           head.appendChild(script);
    
        }  else {
            window.cloneCallback();
        }   
    }
    
    isCacheEnabled();
    

    After that you can simply check for cacheEnabled === true or cacheEnabled === false after some period of time.

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

Sidebar

Related Questions

Is there a short way to write the following using either JavaScript or jQuery?
Is there a way to detect if javascript is executing a script using either
I wonder if there is a way to either programatically or using a third
Is there a way to record the screen, either desktop or window, using .NET
Is there a way to create a Distinct query in HQL. Either by using
I'm looking for a way for javascript to tell how far a user has
I'm very new to Oracle and was wondering if there's a way either through
Is there a way to coax either the h:outputLink or s:link tags into generating
Is there an easy way to select either a file OR a folder from
Maybe there is no difference, but is either way better than the other (or

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.