Nasty Bug: Safari doesn’t cache stuff.
photo by: Simon Barnes
I swear I’m not making this up.
I couldn’t believe my eyes when I found it. Safari is one of our favorite browsers, and we love their work on standards compliance and speed, particularly JavaScript, but this particular bug is really driving us crazy. I’ve logged it with Apple (#5786274), and a fix is promised, but in case you’re getting hit with this and are as baffled as I was, here are the details:
- If your computer has less than 1GB of RAM, Safari fails to cache items larger than 104,857 bytes.
- If your computer has more than 1GB of RAM, Safari failes to cache items larger than 209,715 bytes.
- JPEGs, at least, are temporarily cached in RAM. Whew. But upon browser restart, you’ll see they didn’t make it to the disk cache, so you have to get them again.
- Other objects, like SWFs or videos, though, don’t even make it to the RAM cache, let alone disk. Load the same SWF back-to-back, and you’ve just transfered the bytes twice. Ugh.
Very easy to reproduce yourself from the comfort of your own home, so go for it. Just fire up HTTP Scoop or Wireshark or tail your server’s HTTP logs and start hitting stuff. Marvel at the # of excess bytes transferred across the wire that you didn’t need.
Here are a couple of test URLs so you can see for yourself:
As a self-professed Apple fanboy, I can’t wait for a fix. In the meantime, we’ve had to jump through all sorts of hoops to ‘dumb down’ some of our most exciting new features.
UPDATE: Yes, I’ve tried with every Cache-Control and Expires header known to man. No, it doesn’t make a difference. Try it yourself.





April 6th, 2008 at 6:22 am
Don, You aren’t serving the files with any Cache-Control or Expires header ? Does it make any difference if you add those headers
April 6th, 2008 at 9:25 am
@Yusuf Goolamabbas
Nope, makes no difference.
April 6th, 2008 at 11:33 am
[...] basis, especially now it’s much faster and integrates better on the Mac and given that Safari seems to be quite selective at what it caches. But not [...]
April 6th, 2008 at 2:22 pm
[...] From: SmugBlog: Don MacAskill » Blog Archive » Nasty Bug: Safari doesn’t cache stuff. [...]
April 7th, 2008 at 5:10 am
I’ve always suspected this, but I didn’t think the Safari developers could make such an enormous oversight.
April 9th, 2008 at 9:56 am
There’s a bug in Webkit which seems to be related to this.
http://bugs.webkit.org/show_bug.cgi?id=15798
April 9th, 2008 at 3:38 pm
And to be honest – why should I care for this? In fact I always turn all the cache settings off. I really prefer my browser to get all the content “on-the-fly” from the web, even if it’s a little slower…
April 15th, 2008 at 6:05 pm
Ahh, nice catch. I just noticed this today on our app too.
p.s. Charles is a nice HTTP monitoring app too: http://www.xk72.com/charles/
April 25th, 2008 at 7:19 am
I’d really like to know the solution for this actually.
May 3rd, 2008 at 7:15 am
Safari 3.1.1 on Windows XP. How do I turn cache settings off?
May 6th, 2008 at 3:39 am
[...] où c’est plus étonnant c’est que Safari 3 a lui aussi des limitations qu’on n’attendait pas. Entre particulier les objets supérieur à 104 ko (le double si vous avez plus de 1 Go de RAM) ne [...]
May 22nd, 2008 at 1:39 am
I just found this out the hard way – made a large flash site that preloads content in the background and relies on it being cached (files are 5mb+) – doesn’t work at all on latest safari basicly, this is a disaster
Any hints about fixes for this would be greatly appreciated.
May 28th, 2008 at 5:25 pm
Don, I think this is now fixed in 10.5.3.
May 28th, 2008 at 9:45 pm
Yes, the fix for this issue is present in the Mac OS X 10.5.3 update released today.
June 4th, 2008 at 2:38 am
[...] can confirm that the bug in Safari (and WebKit) which prevented caching of SWF files has been fixed by the recent 10.5.3 update to OS [...]
August 3rd, 2008 at 7:31 am
It seems that Safari 3.1.2 (5525.20.1) on 10.5.4 doesn’t cache *any* files again independently from the size. I’m so stumped, that I cross-checked all preferences a dozen of times. Can anyone confirm?
August 8th, 2008 at 10:35 am
Confirming that Safari 3.1.2 (5525.20.1) on 10.5.4 with all Apple security updates does not cache any files on my configuration: G4 FW800 Dual 1.25G, 768MB RAM.
August 8th, 2008 at 10:42 am
I’m unable to reproduce the problem with Safari 3.1.2 (5525.20.1). All files, even large SWF and JPEGs, seem to be caching fine for me.
Can you provide some examples and your test methodology so I can verify?
August 12th, 2008 at 10:16 am
I used ngrep/tcpdump to really check what goes through the wire. I also checked access logs on some web server I’ve access. It really seems, that Safari doesn’t even respect Cache-Control/Expires HTTP headers. It didn’t see not one “HTTP/1.1 304 Not Modified” while sniffing. Firefox does for the same sites.
September 16th, 2008 at 9:46 pm
Safari 3.1.2, osx 10.5.4, 2.16 GHz Intel Core Duo(2 GB 667 Mhz DDR2 SDRAM)17″MackBook Pro – Not Caching
Safari 3.1.2, osx 10.4.11, Dual 2.7 GHZ PowerPC G5(8 GB DDR SDRAM) – Not Caching.
I have noticed this a few years ago, and looks to be the same as I test today. Yeah, I usually use Firefox.
I don’t understand why this has not been fixed.
September 26th, 2008 at 9:36 am
For these saying that dont care about it, try using safari over a Wireless Network, EDGE, or even 3G, and you´ll se how frustating it is to not having cache. Specially when you are using a limited data plan. Actually I use the Internet with my Macbook Pro in most of the time over 3G wireless network, and its not so fast as a DSL or Cable connection. I love Safari but I was force to swith to Firefox because of this.
September 26th, 2008 at 4:37 pm
[...] Fabiano wrote an interesting post today onComment on Nasty Bug: Safari doesnâ??t cache bstuff/b. by FabianoHere’s a quick excerptFor these saying that dont care about it, try using safari over a Wireless Network, EDGE, or even 3G, and you´ll se how frustating it is to not having cache. Specially when you are using a limited data plan. Actually I use the Internet b…/b [...]
September 27th, 2008 at 12:56 am
[...] Comment on Nasty Bug: Safari doesnâ??t cache bstuff/b. by Fabiano wrote an interesting post today onComment on Nasty Bug: Safari doesnâ??t cache bstuff/b. by Comment on b…/bHere’s a quick excerptFabiano wrote an interesting post today onComment on Nasty Bug: Safari doesnâ??t cache bstuff/b. by FabianoHere’sa quick excerptFor these saying that dont care about it, try using safari over a Wireless Network, EDGE, or even 3G, b…/b [...]
December 19th, 2008 at 10:13 pm
Thak you for the news
April 2nd, 2009 at 8:56 am
I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.
Joannah
http://transcendmemory.net
October 26th, 2009 at 3:48 pm
I'm using a older version of Safari and don't want upgrade, Hope they solved this in the new version. I might give a it a try.
November 6th, 2009 at 4:00 pm
Love it! You got me so excited to get one and start shooting video!
November 23rd, 2009 at 10:08 am
No cache bug when testing here or at http://blogs.smugmug.com/don/2008/04/04/nasty-bug...
using Safari 4.0.4 on Windows XP. Cache works properly, as long as Private Browsing is turned off (as expected). Cache even persists after closing and restarting Safari.
November 23rd, 2009 at 10:10 am
Sorry, meant to post this site as the other example of a page where Safari caches properly:
http://www.rudinswagerman.nl/weblog/index.php?id=...