Disabling Chrome cache for website development

后端 未结 30 1582
-上瘾入骨i
-上瘾入骨i 2020-11-21 06:49

I am modifying a site\'s appearance (CSS modifications) but can\'t see the result on Chrome because of annoying persistent cache. I tried Shift+refresh but it doe

相关标签:
30条回答
  • 2020-11-21 07:05

    There is a chrome extension available in the chrome web store named Clear Cache.

    I use it every day and its a very useful tool I think. You can use it as a reload button and can clear the cache and if you like also cookies, locale storage, form data etc. Also you can define on which domain this happens. So can clear all this shit with only the reload button which you anyway have to press - on your chosen domains.

    Very very nice!

    You also can define a Keyboard Shortcut for this in the options!

    Also another way is to start your chrome window in incognito-mode. Here the cache also should be completely disabled.

    0 讨论(0)
  • 2020-11-21 07:05

    If you're using ServiceWorkers (e.g.: for Progressive web apps), you'll likely need to check "Update on reload" under Application > Service Workers in dev tools too.

    enter image description here

    0 讨论(0)
  • 2020-11-21 07:07

    Actually if you don't mind using the bandwidth it is more secure for multiple reasons to disable caching and advised by many security sites.

    Chromium shouldn't be arrogant enough to make decisions and enforce settings on users.

    You can disable the cache on UNIX with --disk-cache-dir=/dev/null.

    As this is unexpected crashes may happen but if they do then that will clearly point to a more severe bug which should be fixed in any case.

    0 讨论(0)
  • 2020-11-21 07:07

    I just got caught out but not necessarily due to Chrome.

    I am using jQuery to make AJAX requests. I had the cache attribute set to true in the request:

       $.ajax({
            type: 'GET',
            cache: true,
            ....
    

    Setting this to false fixed my problem but this is not ideal.

    I have no idea where this data is saved but I do know that chrome never hit the server for a request.

    0 讨论(0)
  • 2020-11-21 07:07

    I had the same problem, I tried :

    • Control Shift R,
    • Disable cache in F12
    • Control F5.

    Then I discovered that using a .appcache manifest for a non https site is deprecated. I removed my site.appcache file and its reference in the html tag and now I'm seeing the latest version of each page!

    0 讨论(0)
  • 2020-11-21 07:08

    Not sure what you are using, but if you are using ASP.Net you can do the following which works like a charm:

    <link href="@Url.Content("~/Content/Site.css")?time=@DateTime.Now" rel="stylesheet" />
    

    Basically it will automatically append the Date and Time to the end of the file each time it is ran, meaning since the file name is technically different, you will never have to worry about it getting cached again.

    0 讨论(0)
提交回复
热议问题