TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Application Cache Is A Douchebag

90 点作者 mathias大约 13 年前

8 条评论

simonw大约 13 年前
Jake based this article on the work he did on our offline HTML5 mobile app ( <a href="http://m.lanyrd.com/" rel="nofollow">http://m.lanyrd.com/</a> ) - doing offline right is surprisingly trick and full of edge cases, and I haven't seen them documented in as much detail anywhere else.
评论 #3944854 未加载
pavel_lishin大约 13 年前
&#62; GOTCHA #8: REDIRECTS TO OTHER DOMAINS ARE TREATED AS FAILURES<p>So are redirects to your own domain, though not quite the same as here. What it means that while downloading the resources specified in your manifest file, encountering a 302 means that the entire applicationCache fails. Downloaded 99 static files fine, and then get a 302? Congratulations, your cache is now invalid.<p>&#62; GOTCHA #9: AN EXTRA HOOP TO JUMP THROUGH FOR XHR &#62; You can make XHR requests to cached resources while offline, unfortunately older versions of WebKit finish the request with a statusCode of 0, which popular libraries interpret as a failure.<p>Not that much older. This is the case for iOS5.1, the last time I checked, and for every Android phone I've tested this on as well.
评论 #3943961 未加载
Joeri大约 13 年前
Appcache is an app packaging mechanism, and should be treated as such. The manifest is the equivalent of a plist or xml file describing the app package. It actually makes a lot of sense when you view it like that. By extension, you should only put stuff into appcache that you would put in a native app bundle.<p>I've built an appcache app that is a bunch of static javascript (in the CACHED section) contacting a bunch of services in the NETWORK section. There is no FALLBACK section, because any resource is either online or offline, but never both. The UI is designed so the user knows which content is online, and can decide for themselves if they have good enough connectivity. Dynamic content goes into localstorage if it needs to be persisted. This way of using appcache works very well and is mostly painless.
peterwwillis大约 13 年前
<i>Yes, that’s right, I verbified “offline.” Yes, I verbified “verb.” Feel free to inbox me grammar complaints that I’ll trashinate.</i><p>I think more worders should matriculate into the Strongbad School of Verbinizin' Speechy Things.
评论 #3947048 未加载
saurik大约 13 年前
&#62; GOTCHA #3: THE APPLICATIONCACHE IS AN ADDITIONAL CACHE, NOT AT ALTERNATIVE ONE<p>This section is not quite true, at least for WebKit. This article states that the application cache will use the normal browser cache when making outgoing requests, honoring whatever cache control headers were sent by the server. What actually happens is that the browser always forces a revalidation of the content with the server, regardless of what the cache control headers that had been served.<p>Now, I certainly /wish/ it were the case that it honored the normal browser cache, but it simply doesn't. The result is that the application cache makes these outgoing requests painfully and arduously one-at-a-time, waiting for the previous one to entirely complete before making the next one... over a mobile data connection this takes /forever/, and it is quite possible that it simply does not finish by the time the process is aborted by one of these needless server requests failing or the window being closed.<p>Normally, you can mitigate these issues by sending files with "cache this effectively forever" headers and always using unique filenames, but with the application cache manifest system (which you are going to be using to support guaranteed-consisten offline operation) you are forced to wait for every request to resubmit before seeing the update.<p>Here is the code from WebKit's ApplicationCacheGroup.cpp, where you can see "max-age=0" being sent as Cache-Control for the outgoing requests. (Sending that header as a user-agent serves to "force any intermediate caches to validate their copies directly with the origin server", per RFC2616).<p><pre><code> PassRefPtr&#60;ResourceHandle&#62; ApplicationCacheGroup::createResourceHandle(const KURL&#38; url, ApplicationCacheResource* newestCachedResource) { ResourceRequest request(url); m_frame-&#62;loader()-&#62;applyUserAgent(request); request.setHTTPHeaderField("Cache-Control", "max-age=0");</code></pre>
评论 #3948106 未加载
Throlkim大约 13 年前
Interesting read and nicely written. It's just a shame HN doesn't have a 'report' feature like Reddit, as I can't report all the whiners in this thread as douchebags.
logjam大约 13 年前
Male here.<p>Most professionals will no longer bother to read an article with a headline that uses insulting, sexist words.<p>If you worked for me and wrote that title for an article about something we were working on, you wouldn't work for me any more. Period.<p>Tech culture is moving away from childishness, and there were a large number of other words you could have used in your title.<p>Go learn some.
评论 #3945488 未加载
评论 #3945506 未加载
评论 #3945393 未加载
评论 #3945528 未加载
评论 #3946085 未加载
评论 #3945922 未加载
评论 #3945403 未加载
评论 #3945858 未加载
评论 #3945823 未加载
评论 #3945539 未加载
parfe大约 13 年前
Sweet, let's unabashedly support more sexism! That's what the tech industry needs.<p>Somehow, an article describing caching of web applications manages to denigrate women, <i>for no reason</i>.<p>The underrepresentation of women in tech is caused by this mindless sexism, like body-shaming women. Douche bag is a sexist insult. You're insulting your target by associating them with feminine care products. It's a direct associating between "This thing is womanly so it is bad." Even after several other stories these digs at women still get publicized!
评论 #3945325 未加载
评论 #3944989 未加载
评论 #3944873 未加载
评论 #3945064 未加载
评论 #3944827 未加载
评论 #3945303 未加载
评论 #3947058 未加载