iOS Web App - how to deal with overzealous app caching?

后端 未结 1 1172
盖世英雄少女心
盖世英雄少女心 2021-02-05 12:56

I\'ve been developing a pretty complicated HTML5 web app for the past month. Last night my iPhone suddenly decided to cache all JS, CSS, and images an

1条回答
  •  你的背包
    2021-02-05 13:07

    For what it's worth, and it's not a perfect solution, we had to settle with appending query strings. I've written a shell script to make this and a few other tasks bit more automated, you can look at the source on GitHub. A few details:

    • It's designed for JS but can easily be edited to handle CSS too.
    • It takes all files listed in script_order.txt and compiles them with Google's Closure Compiler
    • Groups them into chunks under 25kb when possible (iPhone won't cache anything over 25kb pre-gzip, although apparently this extends only to browsers and not standalone webapps)
    • Outputs a PHP file with
提交回复
热议问题