Browser cache, do you speak it?

Hey Apple, stop dumping my cache!

This happens to me all the time on iOS:

  • Start writing a blog post in a text field in Safari;
  • Open a new tab to look up something related;
  • Go back to the first tab, and OH HOW NICE it reloads the page and discards my edits.

What year is this? FFS.

Tags: , ,

46 Responses:

  1. Jeremy Wilson says:

    Jesus this pisses me off too! I'd like some explanation of why it does this. I imagine I will be disappointed with the answer.

    • Alan Storm says:

      The fuzzy, hand wavy explanation I heard a while back is mobile Safari will store a certain number of website/page states in RAM, but if the device's RAM ceiling is hit (or some other arbitrary amount of RAM) it just loses the page, opting to reload the page from the web rather than caching the entire page out to disk — or whatever you call persistant storage on an iPhone/iPad. Also something something power consumption.

      All of which I interpreted as spending time improving the browser **application** experience vs. built-in app experience isn't considered worthwhile by management or politically feasible by developers on the ground.

      • jwz says:

        That number is apparently "one".

        • Ewen McNeill says:

          Based on a friend's early experience with an iPod Touch (basically iPhone feature set, but without the GSM radio), yes "one" was the number of pages cached. There the symptoms were that if she was out of WiFi range (no GSM, right), then she could read the tab that was still left open, but changing to any other tab would cause each one visited to be invalidated and then fail to load due to lack of network.

          My impression with more modern iOS on an iPhone/iPad is that there are some situations where it won't immediately invalidate the page when you move away from it (eg, watching the GSM transfer spinner suggests it isn't reloading the page sometimes, such as when it's been very recently reloaded). But that seems to be an accident, rather a designed in feature.

          I too really think that at minimum content typed into forms should be preserved while the tab is open, even if the HTML/media itself ends up being refreshed from source. But honestly I'd rather just deal with the flash wear of flushing to "disk" any time it has to go from RAM, rather than having to refetch over slow GSM.

          It's not like there's less RAM or disk available than early desktop browsers had. And they had working caches.

          Ewen

  2. A.X. Ian says:

    Use another browser like Atomic. Safari is aggressive like that.

  3. pavel_lishin says:

    Honestly, I don't even trust regular browsers to do this. Not because of the caching issue, but because every once in awhile, I'll hit "submit", and my login will have timed out - or I will have forgotten to fill in a form field - or something or other - and poof, my fucking input is gone. Sure, in Chrome I can (usually) bring up the console and check what the form submission was, but in general I'll copy-and-highlight before I submit, or just write my submission in another app and paste it into the form field.

    It's a good, paranoid habit.

    • jwz says:

      Yeah, that used to be an important habit to have -- in the nineties. I haven't seen a web page fail in that way in desktop Safari for, like, at least eight years, and it was a shocker then. Thus my "What year is this?" question.

      • Sean Barrett says:

        I've definitely seen web pages fail more recently, although possibly not the browser's fault. I still get the occasional 'go back a page, nope, form submission is gone' issue, but maybe the page is setting directive, and it's not the browser's fault. The worst offender is twitter's web app, which at least in Firefox if you switch focus away, then click in the window to focus back, the click in the window discards any pop-up reply tweet you might have pending.

        So the web I visit (not on iOS) is still in the 90s as far as I can tell.

    • In this situation (form submission fails) I can hit Back and my form input will be there. It seems to be reliable in Chromium. Firefox also tries to do this, but I think sites that rely too heavily on Javascript sometimes break it.

    • 205guy says:

      I had this submit-back-poof thing happen to me today. Latest FF, and anyways, I suspect is has to do with the website--never cared enough to debug it. I thought maybe there was a FF plugin that would cache the submitted fields, then realized it would be a security nightmare and forgot about. It's not like I post important things anyways. If it was a short comment, I retype it. If it was a long comment, I figured it was too long and rewrite it shorter.

      I've seen the same thing on iOS, but what really gets to me is when it tries to reload pages even in airplane mode. You know that moment in an airplane when you think you finally have time to read some random article sitting on one of your open tabs: you can see the preview but then when you select it, it goes poof. There must be some website setting that tells it to reload, because now I know there are some websites I can reload just before takeoff and read for the next hour, and some that will always reload when I try to read them. You'd think the browser would know when running in airplane mode then ignore that setting (or you know, just ignore it all the time because it's a fricking mobile device), so yeah, I'm often left wondering what year this is too (then again, I do have a 3GS running 3.2 because hey, it still runs).

  4. John Morton says:

    Using Lazarus may partially mitigate the problem, in that, at least you'd get the partial post back.

    • jwz says:

      Non-Safari browsers are not what all the other apps hand URLs off to. You can't set them as the default, so their usability is shit, so I won't use them.

      • John Morton says:

        Sorry, should have said: It's a browser plugin that allows you to restore form state. It's available for Safari these days.

      • DFB says:

        Who are you and what have you done with jwz? Safari is terrible. Both Chrome and Firefox remember form contents across crashes which are far fewer. Also, they use less memory, well, every other release for Firefox.

        • jwz says:

          Hey, I'm still here and I'm still surrounded by poor reading comprehension!

          There is no way to change the default browser on iOS, doofus. See the "iOS" up there in the second sentence? Yeah...

          I do not find desktop Safari to be crashy, whereas I do find the Firefox UI to be the usual Linux moving-target of someone's "learning experience", which is why I don't use it. But that's all irrelevant because that's not even remotely what this conversation was about.

  5. Jed Davis says:

    In compilers, the optimization of throwing away a value because it's more efficient to compute it from scratch than to store it in memory is called “rematerialization”. If it can be the case that the value you recompute is not the same as the one you threw away, that is called “a bug”.

      • Jed Davis says:

        By which I mean that I think you're being too nice to this piece of software. As I see it, it's not just that they were reinventing the wheel of browser cache and didn't realize they needed to round off the corners; rather, they got a wheel that was already round and planed it down into a hexagon for x-treme weight savings, and now it's bumpy and sometimes falls apart and maims the horses.

  6. stickfigure says:

    You don't want to hear this, but:

    This horrible misfeature is one of the reasons I abandoned iOS almost two years ago and went android. I'm pretty disappointed to hear that it's still a problem... but then again, not entirely surprised either. As an actual communications device (digital or voice), I thought iOS sucked. No tethering (unless you pay assrape fees) and no ability to use a local sim card while traveling.

    Speaking of assrape, Tmobile prepaid is selling a 5GB data, unlimited text, 100-minute talk plan for $30/mo (as in, the amount you pay - not "plus taxes"). Which I can (and frequently do) tether. What does that iPhone cost to use?

    • jwz says:

      "...but you kept typing anyway."

      Android UI is an unusable joke. Plus, I (currently, still) have more control over the privacy of my data with iOS than with the Google Hivemind.

      I don't give a shit how much it costs, I just want an appliance that works. Android fails that test miserably.

      • Jonas says:

        Now that's not fair. Both platforms own your data, but with Android at least it's optional. I run (granted, not all, but still) Android devices without a Google account. The main problem is being unable to use the app store thingy, otherwise it works great.

        I find the Android UI nowadays to be far more intuitive than Apple's, for reasons including your concern here. But that's large due to matters of taste of course (and the lack of a "back" button, specifically). Your concerns about data privacy is simply not true.

    • Hey, Android is like this, except less predictable. Read half of a LiveJournal comment thread, notice a notification about incoming mail, tap it, read the mail, switch back -- whoosh, the page is unexpectedly reloaded. Good luck finding which threads you had expanded and where you stopped reading.

      The Nokia N9 (Meego/Harmattan) is the only phone I've seen that gets this right.

    • martin langhoff says:

      "This horrible misfeature is one of the reasons I abandoned iOS almost two years ago and went android."

      Maybe two years ago. Today, the browser on Android ICS on my Transformer does the same sh*t jwz is complaining about.

      Lousy User Agent programmers -- PROGRESS, do you speak it?

    • anonymouse says:

      I've had the same problem in Android. It's less extreme, in that I can generally have quite a few tabs open, but more frustrating for a couple of reasons. First off, when you switch to a page that it's purged, half the time it doesn't just show you a blank page, it shows you the page that's already there, and then proceeds to reload it anyway for who knows what reason. The other annoyance is that this isn't generally triggered by doing stuff in the browser, it's triggered by doing stuff in other apps, notably Maps. But it's somewhat nondeterministic and thus annoying.

  7. J. Peterson says:

    Amen. Even just the fact it usually needs to stop and reload the page at all is supremely annoying.
    [Cue AT&T rack-up-the-bandwidth conspiracy theories...]

  8. Matt Reynolds says:

    I think you're running into the Gadget 2.0 version of CADT, where all your previously fixed bugs are tossed away with abandon to pursue the Latest Shiny New Thing. Both Android and iOS suffer pretty badly from this.

    As a long time reader, first time caller, I must say that it's amusing to hear you speak of any of these "appliances" as anything but laughable jokes of "usability". They can read mail ; they're done evolving. The fact that they browse the web at all is a fluke.

  9. Jackson says:

    Agreed, it is absolutely irritating (happens to me frequently on iOS). Sadly it's been happening in Lion as well, where it forces a reload on all open tabs/pages.

    On iOS, take a look at your diagnostic logs, and see if you're getting a lot of low memory errors. I'm not saying that would solve anything, but you could at least see if it's a regular occurrence.

    Cheers

  10. Not only is this frustrating as hell on iOS, I swear I've seen this same behavior in OS X Safari since upgrading to Lion. Shame, because the bloat of every other browser had me giving Safari a try for the first time in ages, and I was liking it until this particular "feature" reared its ugly head. It seems that unitasking is the future.

    • jwz says:

      I've never seen desktop Safari do this (lose forms) but I have seen it do the "reload every web page" thing, where paused Youtube videos will start playing again. Maybe once a month? That happens when the "Safari Web Content" subprocess dies and is re-started, which is the new-ish security sandbox. So, if it's any consolation, before that sandbox was there, the whole browser would have just gone poof. No, I wouldn't be consoled by that either.

      • filbert says:

        aha! thank you for this. i've been plagued by the "webpages are not responding. continue?" bug for months (daily at least) and wondered what the fuck was going on. it seems to happen most often on a flakey/slow internet connection so the unstoppable joy of fifteen youtube videos attempting to simultaneously play is even more special.

  11. Joe Crawford says:

    You may get slightly less stress frustration using the WordPress iOS app to compose blog posts.

    Back when people used Firefox the Lazarus Form Recovery plugin worked great for this. Apparently the developer now has variants for Safari, Firefox, and Chrome now.

    I'm aware that these tools in no way mitigate the thing you're blowing off steam about.

  12. Legolas says:

    As for the people saying 'other browser', I can only say that I recognize the 'switch tab reloads' un-feature from my browser replacement (Sliepnir). I don't type much in it, so I never had that lose me anything luckily. Thanks to this thread, I now know what to blame it on (too little memory sounds perfectly plausible).

  13. jwz says:

    I did some experiments, and it turns out it does this shit whether the page containing the filled-out form was a GET or a POST. It's actually worse if it was a POST, because in that case when it reloads, it discards all the original POST arguments too, and just submits it as a GET with no args. Slow clap. Slow clap.

  14. Eric says:

    I have experienced this under an iPod touch, iPhone, safari under lion, and first gen iPad, but I have yet to see this behavior under the third gen iPad and the iPhone has gotten much better with ios 5. With the limited ram on some of the earlier iOS devices it's amazing they can render half the crap that's on the web.

    Honestly anything I care about I compose under one of the many nice Dropbox linked editors before cuting and pasting into mobile safari. I have also seen sites moving to auto-saving using cookies to mitigate this issue.

  15. John Caruso says:

    Yeah, this really, really sucks on an iPod Touch when you load up some web pages while you have wireless access so you can look at them a little later when you don't, and Safari wipes them clean (regardless of how static they were) before failing to reload them. Thanks, Apple!

    • Lun Esex says:

      Here's a trick: Once you load a page, take a screenshot. Works great as long as you don't want to scroll around on the page. Also good for maps.

      Before AT&T started unlocking iPhones this past weekend (hear the angel chorus sing) I'd do this with my iPhone when traveling outside of the U.S. since their international data roaming plan costs so much for so few bits.

      • filbert says:

        did you just suggest offline browsing on an iPOD by capturing a series of screenshots?

        • Lun Esex says:

          I thought it was pretty clear that that's what I was suggesting, yes.

          If the OP had said "read them" rather than "look at them" I would have mentioned the Instapaper app, which caches just the text offline in a "reader" mode.

          It sucks that mobile tech has gone backwards this way (on both iOS and Android), but at least iOS makes taking screenshots effortless.

          • MattyJ says:

            My God. Welcome back, "Take a picture, it lasts longer." I thought Pee Wee Herman killed that almost 30 years ago. Thanks for bringing it back.

            PS Awful fact: Pee Wee's Big Adventure was almost 30 years ago.

  16. Lefty says:

    Ahh, mobile browsers. Learning all the same lessons that Netscape did in the mid '90s all over again.

    Those who do not study history, etc etc.

  17. Rory says:

    I'm a few days late, but this annoying crap is fixed in the Safari 5.2 DP. Unfortunately 5.2 is still wonky enough that it's not completely suitable for daily use by mortals, but if you can put up with some odd strangeness now and then, I really suggest using that instead.

    The other bug that's killed dead in 5.2 is the 'gestures stop working until you close and restart' bug. Thank god.