Enable caching to upload files

You’re an Apple Safari browser user. After upgrading to OS X 10.4.8, you are unable to upload files to 37signals’s Basecamp via that application’s easy, web-based uploading tools. Or you are unable to upload your logo to Boxes & Arrows’s events listing. Or you are stymied in your efforts to upload your photos to JPG Mag.

The fault lies not with Basecamp or Boxes & Arrows or JPG. Nor is it strictly because you’re using an Intel Mac. Camino, Firefox, and Opera still let you upload images over http. The problem is Safari. But not every Intel-Mac-wielding Safari user suffers from it. Many continue to upload files after upgrading to 10.4.8. They glance pityingly at you out their passenger windows as they speed past.

What is the problem? You’re a web designer. As a web designer, you’ve used a third-party product like Safari Enhancer to disable caching in your browser.

If you don’t disable caching in your browser, then Safari becomes kind of useless to you as a web development tool, because Safari hangs onto files like a junkyard dog clomps onto a postman’s thigh. Safari will hold onto outdated CSS, outdated text, outdated images. You’ll quit and restart. You’ll check your SFTP settings repeatedly, wondering why you keep uploading updated content to your web project, but Safari keeps showing you outdated content.

Safari shows outdated content for hours after other browsers (even browsers with caching enabled) have recognized that something changed. Safari does this because it makes browsing faster for ordinary users who are not web designers. It works. Unfortunately, what makes Safari fast and fun for ordinary users makes it a pain for web designers—unless they disable caching.

Before 10.4.8, you could disable caching in Safari and still upload files over http. After 10.4.8, you can’t. It’s not a feature, it’s a bug. Until Apple fixes it, you can leave caching disabled in Safari and use Firefox, Camino, or Opera as your default browser—or re-enable caching, and add an hour of Stupid Time to your web development and testing process.

[tags]web design, apple, mac, os x, safari, browsers, web development[/tags]

45 thoughts on “Enable caching to upload files”

  1. Weird…this is news to me. I’m on an Intel Mac and haven’t had any problems refreshing properly in Safari. Now, I do most of my testing in Firefox (to take advantage of Chris Pederick’s lovely Developer Toolbar) but I’ve never experienced any inability to refresh. Besides, Command+ Alt + E empties your cache easily enough if you are have trouble.

  2. Option-reload always seems to reload everything for me, including referenced stylesheets and scripts. I don’t use @import a lot, however. Maybe that’s the source of the problem?

  3. It’s become a familiar refrain between me and my co-workers: when something isn’t showing up, we always say: “reload twice?”

    Safari seems to refresh only the HTML the first time you press reload, but the second one always gives it the kick in the pants needed to grab CSS, images etc.

    The only exception I’ve found to this is Flash content. Sometimes the only way I can refresh that is by loading the actual movie in a separate tab, hitting reload and then reloading the original page.

  4. I second that holding down option and clicking reload always works. I use @import religiously too, so that doesn’t seem to affect it.

    In fact I’ve not suffered any pain with Safari’s caching not refreshing. It seems like IE 6.x has been the browser that always clinged to web caches for me.

    I’d also say that most useful third-party plug-ins for Safari almost always break and need updates every time Apple patches WebKit (the core of Safari).

    I don’t put much stock in Safari with third-party plug-ins for this reason. Maybe this will change as WebKit/Safari matures, but do realize that updating your system while running third-party Safari plug-ins is a risk.

    That also applies to Mail plug-ins, though not as much in my experience (probably because Mail gets patched less).

  5. I have a client who experiences the same things Luke describes. I have recently obtained use of a Hackintosh, a Mac running on a Celeron-based Wintel box. I run Safari and I now see exactly what my client sees. First pass, new html and horribly broken design; second pass, css loads, images drop into place and usually all is well.

    Stupid Time indeed.

    I’ve long developed sites on Windows boxes running Firefox, or something smarter than IE.x and test in others last, including Safari. I think maybe I’ll continue doing it that way, and continue to heckle my client into dumping cache (dumping cash, he pays me hourly).

    Oops. Did I say that out loud?

  6. I am webdesigner too and I often test in Safari and yes, I don’t have the Safari enhancer.

    Before reloading a page (after uploading new files to the server) I use the keyboard «Apple-Alt-E» whichs empties the cache of Safari. So all you webdesigners out there: Testing in Safari is still possible without quitting and restarting. Hitting this shortcut takes you a second or two before you hit «Apple-R» to reload.

  7. “It seems like IE 6.x has been the browser that always clinged to web caches for me.”

    The bane of my existence.

    Also, I dunno. Why use Safari at all? Firefox kicks its azz.

  8. I’ve not suffered any pain with Safari’s caching not refreshing.

    I have, as have developers I work with.

    Why use Safari at all? Firefox kicks its azz.

    For one thing, Safari’s treatment of typography is far superior (and far more accurate) than Firefox’s. Strange but true.

    Leaving aside the issue of line-height accuracy, compare the way Firefox and Safari handle italics. Open IE7 CSS tweak show and tell, look at the second paragraph, and compare the way Firefox and Safari treat the italicized magazine title, “Advertising Age.” Or for that matter, abcd efgh.

    If the style sheet specifies Lucida Grande, which has no true italic, Safari substitutes Lucida Sans (which does), while Firefox creates a false italic in Lucida Grande.

    If the style sheet says Lucida Sans, Firefox nudges that font’s true italic, even though no nudge is needed.

    Even on a Mac, Firefox handles type the way, well, the way Windows does. (No offense, Windows fans.) Firefox does this by design, and there certain advantages to Mac-based web designers in seeing how bad their type can look even before checking it in Windows, but it’s not what a typographically sensitive Mac user wants in a default browser. Which is why I don’t use Firefox for my day-to-day Basecamp-using, web-article-reading working day.

  9. Why use Safari at all? Firefox kicks its azz

    Aren’t we all web design extraordinaries supposed to test in all possible browsers and environments?

    FF rocks, can’t argue that, but we’ll have to keep doing this until all browsers display the same things exactly the same way. =) Me thinks.

  10. Another problem with Safari’s Caching, is that it has trained me to always assume that a file that won’t update is because of the browser’s inability to let go of the old one. When, in fact, I’ve put the new file in the wrong directory. This adds even more time to the process and can be maddening when in a hurry. I’ll go through a few attempts to reload, then restart the browser, only to find that I misplaced the updated file, because 8 times out of 10, the file didn’t update on the first try because of Safari’s seeming nostalgia for the old.

  11. I’ll add to my original comment that I think Safari and even other browsers might become more finicky when it comes to caching dynamic content. Or perhaps there could be issues with server time stamps. I’m sure there are many factors so we all might experience different problems than others.

    I wonder if someone over at the Safari blog might know something that would help?

    “Why use Safari at all? Firefox kicks its azz”

    As someone just wrote, as developers it breaks down to hitting the top browsers and that means at least testing in Safari since it’s the KHTML diplomat in the browser community. Firefox is the Gecko base and then you get all the flavors of IE. The top three engines that matter, and Safari share is growing enough that you should not overlook it.

  12. Jeffrey:

    I keep my cache turned on while I’m testing in Safari, but I’ve gotten in the habit of doing two things to help clear the cache:

    1. Hold down the Option key while clicking the reload icon. This clears the cache most of the time.
    2. Use the “Empty Cache…” command under the Safari menu, which has the keyboard shortcut Command-Option-E. This almost always works.

    I’ve grown so used to clearing the cache in Safari that I instinctively do it even when I’m not developing. Muscle memory, I guess.

  13. Jeffrey, can you show a screengrab of the difference on your “Advertsing Age” example? They looked identical to me. I took screen grabs from both Safari and Firefox and then overlaid them. They were pixel-for-pixel identical. I purposely leave my prefs for both programs alone so I can see what the majority other users are seeing.

  14. Safari does occassionally fail to set things free. I’m not sure where the convention began — possibly with Netscape — but I always use shift + reload and it usually seems to do the trick. Also, when I use “preview” from BBEdit I have never encountered this problem in 10.4.8. (Of course, “Preview in BBEdit” uses OS X webkit — very equivalent to Safari — and it updates without reload.)

    I doubt that the problem is Intel-mac specific in any way, but suppose it’s possible . . .

  15. Hi, everyone, thanks for the comments so far. Many have focused on how to make a browser refresh. Maybe I failed to emphasize the main point in my original post. So let me back up.

    All browsers cache. Caching speeds display. Faster display is good for users. Everyone knows this.

    But caching in any browser can interfere with the quick visual feedback that helps designers and developers do their work. So it is a common practice among professional designer/developers to disable caching whenever possible.

    Many of us disable caching in all our browsers (IE, Firefox, Opera, etc.) so we can more readily see the result of changes we’re constantly making to markup, code, and graphics.

    Yes, this makes normal web browsing a bit slower, but most of us have very fast connections and don’t mind.

    Many browsers have a preference setting enabling users like us to turn off caching. But some browsers do not.

    Safari does not have a preference setting enabling users to turn off caching. Moreover, Safari, although I like it very much as a browser, tends to be more retentive of outdated files than other browsers. Put another way, with normal caching on, Firefox (and even IE/Windows) are likely to notice that code or content have changed before Safari does.

    Still with me? Okay, we’re nearly done.

    Because I am a web designer, I disable caching in all my browsers. In order to disable it in Safari, I need to rely on a third-party application. In the past, disabling caching in Safari did not prevent Safari from functioning normally. Specifically, until the OS X 10.4.8 update, you could disable caching in Safari (via a third-party application) and still do something as normal as uploading a file via http in a web application like Basecamp.

    After the 10.4.8 update, file uploading via http breaks in Safari when caching is disabled.

    The specifics of the breakage, not mentioned in the original post: Safari can’t upload files because it thinks the file you’re trying to upload is actually the directory that contains the file, and it isn’t possible to upload directories over http.

    That is a bug. A bug in Safari. A bug introduced with the 10.4.8 update.

    Once I figured out that the cause of the bug was the disabled caching in Safari, I was able to work around the problem by turning caching back on.

    It took me several days to isolate the cause of the bug.

    I wrote the post so people who were experiencing the same problem would know how to solve it, and so Apple’s Safari development team would get wind of the bug and add it to their to-do list (at whatever priority level they deem appropriate).

  16. Those affected by this trouble might try the process listed here.

    It involves deleting the Safari cache folder found in:
    ~/Library/caches/ (tilde is your home directory in Mac OS X)
    then creating a symbolic link to /dev/null with the same name, “Safari.” This will cause Safari to send everything that ordinarily would go into the cache to /dev/null instead, deleting it immediately.

    It may also work to set the “Safari” cache folder to “Read Only” in the Finder using Get Info.

  17. Er, good point Philip, and sorry for skipping right over your point Jeffrey. No, I don’t think the world cares what browser I develop on. My apologies. Some days I’m such a noob.

  18. I’m wondering how Safari will be affected by the upcoming Windows Vista release as far as how it will interact with the growing problem of malicious sites commandering the browser to do evil biddings. IE7 seems pretty adept at stopping this under Vista RC1 with User Accounts Control. Does Apple implement a similar system? I’ve little experience with it.

  19. i absolutely have a caching problem with safari. never with other browsers; IE always loads new content. never a problem; but safari…

    this has caused me endless frustration as a web designer. is the safari development team listening? is there a workaround aside from appending a different variable to the end of a url string each time a page is loaded? not a solution at all, imho.

  20. I’ve been having the picture upload problem. Can’t upload to eBay, blogger, etc. Same with FireFox. Only Camino will upload pics and I really don’t like Camino. And I trusted Apple for so long.

  21. Yikes. I didnt know safari was so cache crippled untill i read this… i suspected it since MAC users would complain that i hadnt updated the webpages of thier sites when in fact i had updated them, using the same filenames where possible for site-wide revision consistency. Please wield your mighty hammer and have them smash this demented bug. Even with loads of .js and server-side includes, i cannot re-name every file of an update just to deal with this.

    thx – j

  22. Disable caching in Safari via Terminal; you don’t need 3rd party fixer uppers and the problems they can create. If you’re not familair with the Terminal, get familiar first. Although this is not dangerous, done properly, playing with a shell is dangerous done wrong. Without further ado, assuming you know what you are doing, the command is:
    rm -fr ~/Library/Caches/Safari;ln -s /dev/null ~/Library/Caches/Safari

    To revert:
    rm ~/Library/Caches/Safari

    If you are wary of the Terminal but are OK with the idea of shell commands in general over a 3rd party front-end for a shell command (what most of ‘em are) try CLIX from RixStep.

    Cool … no preview. ‘Guess everyone here is OK with code.

  23. Note RE: above comment from me: ignore the line wrap; enter the command to disable cache on one line. And please excuse the typo “familair” instead of “familiar”. I’m still getting used to laptop keyboards.

  24. I’m wondering how Safari will be affected by the upcoming Windows Vista release as far as how it will interact with the growing problem of malicious sites commandering the browser to do evil biddings. IE7 seems pretty adept at stopping this under Vista RC1 with User Accounts Control. Does Apple implement a similar system? I’ve little experience with it.

  25. Hi Stephen,
    “i absolutely have a caching problem with safari. never with other browsers; IE always loads new content. never a problem; but safari…

    this has caused me endless frustration as a web designer.”

    Me too! the question is: how many users needs the browser.

  26. Yeah, thank you, that helped a lot! There are still a few other problems, you know, but I hope I can fix them on my own!

  27. I have had this problem on occasion. I suppose I have just learned to be patient with it. But then, I’m only an amateur with a handful of sites of my own, and perhaps they aren’t fancy enough that I need to check them frequently as I program. Still, if you are able to access the page via a different browser, I’m not sure what the problem is. Use the faster browser to double-check as you work, and then be patient with safari after you’ve finished your work. A small price to pay for those who are doing the browser to get faster access to your work. But then, I try to practice a little zen patience, and so I may not be the best person to be giving advice on what is too long to wait for something.

  28. Is the process on clearing cache Safari 1.0 or Safari 2.0 the same? Is it true that when you set your browser to not cache it will slow down your web page viewing? Although this isn’t a perfect solution because some caching may still occur but it does help.

  29. I’ve long developed sites on Windows boxes running Firefox, or something smarter than IE.x and test in others last, including Safari. I think maybe I’ll continue doing it that way, and continue to heckle my client into dumping cache (dumping cash, he pays me hourly).

  30. Ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh!

    Thank you, Jeff.

    You have no idea how long this has been haunting me (since 10.4.8).

    Now I can continue in peace to use FF to work with basecamp, and stop worrying that there’s something wrong with me or, God forbid, my Mac.

Comments are closed.