I'm using Safari to preview web pages as I develop them on my local server. I've got 'Disable Caches' checked in the Develop menu. And yet Safari is still working from a cached version of a stylesheet that's linked from the HTML file being displayed.

I can sometimes override this by Option-clicking the reload button in the location bar, but I want to refresh the page automatically when I save the CSS file. At the moment I'm doing it using an AppleScript that's bound to the Save action in my text editor. I could see using Keyboard Maestro instead. But I need some consistent way to force Safari to do a full reload from the keyboard.

link|improve this question

75% accept rate
I don't think there's a way to force refresh using the AppleScript dictionary. In Safari 5.1 (10.6) you can get the reload button with: tell application "System Events" to tell process "Safari" to button 1 of text field 1 of splitter group 1 of group 1 of tool bar 1 of window 1. AFAIK there's no way to emulate pressing it while modifier keys (or ⇧) though. – Lri Jul 29 '11 at 13:11
feedback

3 Answers

You need to do

Apple+R

To execute a Force Refresh.

EDIT:

Hard refresh was removed as a keyboard shortcut in Safari 5. The old command for that was +SHIFT+R

CTRL+F5 May work but I can't test here.

link|improve this answer
Yes, that's how to refresh the page, but it doesn't bypass the cache. – Gabe Sep 9 '10 at 16:02
Control-F5 just selects the location bar, like Command-L. – Gabe Sep 9 '10 at 16:45
Then it's been disabled completely. I found a number of threads complaining about it. There is an extension that I have NOT tested here: twitter.com/siracusa/status/15683201068 that may do what you want. – JNK Sep 9 '10 at 16:47
No, that extension just creates a button in the toolbar (which I guess some people prefer to the icon in the location bar). I also found a lot of threads complaining about it—i was wondering if someone on here had any special knowledge. – Gabe Sep 9 '10 at 19:37
Sorry! :( <15chars> – JNK Sep 9 '10 at 19:47
show 1 more comment
feedback
* To reload a page and bypass the cache:
      o for version 4 and newer:
      o Hold down the Shift key and click the Reload toolbar button.
      o for version 3 and older:
      o Hold down the Command key, and press R. This kind of "regular" reload will usually bypass the cache.
      o Note that Apple ([1]) claims that clicking the Reload toolbar button has the same effect as Command-R, but this is not true; frequently the button will not bypass the cache. In fact, numerous Web developers have reported erratic behavior in general in bypassing the cache in Safari, in some cases having to resort to both clearing the cache (see below) and then quitting and relaunching the application.
* To completely clear the cache (see note above):
      o From the 'Safari' menu, choose 'Empty Cache...' or hold down the Option and Command keys and press E.
* To disable the cache permanently (this method only works on old versions of Safari 2 on OS X 10.4 and previous versions, and is not recommended as it may potentially (although rarely) cause system instability):
      o Quit Safari by choosing 'Quit' from the 'Safari' menu, or by holding down the Command key and pressing Q.
      o Open a Terminal window by double-clicking 'Terminal' within the 'Utilities' folder, which is within the 'Applications' folder.
      o Type the following commands, which are case-sensitive, each followed by the Enter key:
            + rm -rf ~/Library/Caches/Safari
            + touch ~/Library/Caches/Safari
      o Quit Terminal by choosing 'Quit' from the 'Terminal' menu, or by holding down the Command key and pressing Q.
      o Relaunch Safari.
* To disable the cache for the session (Requires developer menu to be enabled. Go to Preferences, pick the Advanced Tab, then click "Show Develop menu in menu bar"):
      o Click Develop, then click Disable Caches

From: http://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache

link|improve this answer
1  
How does this bypass the mouse? – JNK Sep 9 '10 at 15:05
feedback

There is an option in the menubar Develop->Disable Caches. This is true for Safari 5.1. I'm not sure for the rest.

Screenshot

link|improve this answer
1  
Please read the second sentence of my question again. – Gabe Jul 28 '11 at 17:06
1  
Oops, I'm sorry :) – Mihail Stoynov Jul 29 '11 at 7:01
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.