How to prevent CSS caching on a web page?

后端 未结 9 1862
你的背包
你的背包 2020-12-14 17:42

I am learning to develop xhtml, css web pages. Often I am doing changes in CSS but it do not reflect on page because of browser cacheing and if I manually clear cahceing it

9条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-14 18:09

    You can use random version id in your link. for example use this:

       rel="stylesheet" type="text/css"/>
    

    where myStyle.css is stylesheet file and DateTime.Now.ToString("yyyyMMddhhmmss") function used for generate random different version id. By using this random version id,browser forced to reload your css.

提交回复
热议问题