Disable cache in browser

2019-05-14 00:45发布

Issue

I work a lot with stylesheets, I change something and I check how it looks. However most if not all current browsers, store the stylesheet and thus won't let me see the differences. Only with a lot of Reset Safari, Empty Cache button presses it suddenly updates but this is really annoying.

Question

Is there a way to disable the cache feature in browsers? So it won't store any files and I will always fetch the latest css from the server.

Ps. Safari's Empty Cache and Reset Safari doesn't always clear the cache and Develop > Disable Cache doesn't seem to do anything.

3条回答
你好瞎i
2楼-- · 2019-05-14 01:01

I just found that in the latest version of Safari for macOS, you can press Cmd+Option+R to hard refresh (as opposed to the standard Cmd+R that refreshes with a cache). This is a game changer for me!

Cmd+Shift+R just opens the Reader View on my Mac.

查看更多
一纸荒年 Trace。
3楼-- · 2019-05-14 01:07

Thanks to T.J. Crowder for helping me in the right direction - I figured it out.

On Windows you can, in fact, press Ctrl+F5 to force the browser to refresh.

On Mac Safari you can hold the Shift button, then press the refresh button to do the same.

查看更多
Animai°情兽
4楼-- · 2019-05-14 01:14

In Chrome, IE, Firefox, and most other browsers, Ctrl+F5 ("hard refresh") will force reloading cached resources on the page. I do this all the time. I can't speak for Safari, but I'd expect it would do the same.

Edit: I just did a search for "+Safari +hard +refresh" and it looks like on the Mac, you hold down the Options key while clicking refresh. Some sources say Shift also works, and that Command+Option+E clears cache.

查看更多
登录 后发表回答