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 31315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T13:35:07+00:00 2026-05-10T13:35:07+00:00

CSS and Javascript files don’t change very often, so I want them to be

  • 0

CSS and Javascript files don’t change very often, so I want them to be cached by the web browser. But I also want the web browser to see changes made to these files without requiring the user to clear their browser cache. Also want a solution that works well with a version control system such as Subversion.


Some solutions I have seen involve adding a version number to the end of the file in the form of a query string.

Could use the SVN revision number to automate this for you: ASP.NET Display SVN Revision Number

Can you specify how you include the Revision variable of another file? That is in the HTML file I can include the Revision number in the URL to the CSS or Javascript file.

In the Subversion book it says about Revision: "This keyword describes the last known revision in which this file changed in the repository".

Firefox also allows pressing CTRL+R to reload everything on a particular page.

To clarify I am looking for solutions that don’t require the user to do anything on their part.

  • 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. 2026-05-10T13:35:08+00:00Added an answer on May 10, 2026 at 1:35 pm

    I found that if you append the last modified timestamp of the file onto the end of the URL the browser will request the files when it is modified. For example in PHP:

    function urlmtime($url) {    $parsed_url = parse_url($url);    $path = $parsed_url['path'];     if ($path[0] == '/') {        $filename = $_SERVER['DOCUMENT_ROOT'] . '/' . $path;    } else {        $filename = $path;    }     if (!file_exists($filename)) {        // If not a file then use the current time        $lastModified = date('YmdHis');    } else {        $lastModified = date('YmdHis', filemtime($filename));    }     if (strpos($url, '?') === false) {        $url .= '?ts=' . $lastModified;    } else {        $url .= '&ts=' . $lastModified;    }     return $url; }  function include_css($css_url, $media='all') {    // According to Yahoo, using link allows for progressive     // rendering in IE where as @import url($css_url) does not    echo '<link rel='stylesheet' type='text/css' media='' .         $media . '' href='' . urlmtime($css_url) . ''>'.'\n'; }  function include_javascript($javascript_url) {    echo '<script type='text/javascript' src='' . urlmtime($javascript_url) .         ''></script>'.'\n'; } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 88k
  • Answers 88k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The rand() and srand() functions are all the C++ Standard… May 11, 2026 at 5:41 pm
  • Editorial Team
    Editorial Team added an answer There are no built-in tools to prevent DoS. If you… May 11, 2026 at 5:41 pm
  • Editorial Team
    Editorial Team added an answer You really want to use a single repository, branch the… May 11, 2026 at 5:41 pm

Related Questions

CSS and Javascript files don't change very often, so I want them to be
I'm researching this for a project and I'm wondering what other people are doing
Obviously having whitespace in css, aspx and html pages is a great advantage at
We're not doing real web development. We get our HTMLs from our designers, and
As a little side project, I am starting to build a new website for

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.