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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:15:32+00:00 2026-06-05T16:15:32+00:00

In my application the user has the option to modify the CSS of their

  • 0

In my application the user has the option to modify the CSS of their site.

This is unlikely to change that often, but when it does we need to ensure that they, and their site visitors, see the results instantly.

We do record the date and time that the user updated their CSS so an easy solution would be to just append a timestamp to the url.

However, I would like to know if I can set the cache headers programatically to force the browser to re-request the CSS file if it changes.

  • 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-05T16:15:34+00:00Added an answer on June 5, 2026 at 4:15 pm

    If you include an hash to your url, ie

    http://server.example.com/styles/css.css?hash 
    

    it will get reloaded when the hash changes, because the browser will fetch it from the new url :

    Version 1:

    <style type="text/css" link="styles/css.css?hash=v1" />
    

    Version 2:

    <style type="text/css" link="styles/css.css?hash=v2" />
    

    Client caching is a client matter, let them do as they see fit : a new URL means the ressource has changed, so it will need to be reloaded. Keeping the same URL with cache control headers may lead you to a world of pain, because of varying client implementations.

    If you put cache control headers (last-modified, expires, ETAG), you cannot be sure that you CSS will get refreshed when it changes :

    • because aggressive browser (or proxy) caching may ignore those.
    • because you may serve V1 on May 1st, with an expiration date of Jun 1st, update it to V2 on May 15th, and your clients will have to wait 15 days to get the new version.

    With the url hash, the worst case scenario is that the client does not put your css in cache, but user experience is not altered, as they always get the latest version.

    With expiry date or last modified date, worst case is that the client gets an old version, and this will alter the user experience 🙂

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

Sidebar

Related Questions

In my application user has an option to change his background by choosing an
I've got an old application that has user passwords stored in the database with
I have an application that needs to determine whether a user has made a
During my application setup, the user has the option of installing a new SQL
I’m wanting to create a iPhone application where the user has the option to
If you'd write an application where some privileged user has the option to create
I'm designing an application that has two [three including administrators] user types: Buyers and
I have an application where user can download documents. User has option to download
I am developing a WPF application, where user has the option to navigate between
While running my application the user has the possibility to show or hide a

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.