On 10/10/07, <b class="gmail_sendername">Ian Hickson</b> <<a href="mailto:ian@hixie.ch">ian@hixie.ch</a>> wrote:<div><span class="gmail_quote"></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Fri, 21 Sep 2007, Robert O'Callahan wrote:<br></blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">> -- Several Web app authors have asked for the ability to test whether a
<br>> resource is cached, for their online apps. For example, when you're<br>> zooming in and out of a map, the application could choose which tile(s)<br>> to use for the animation by scaling them up or down. This would also be
<br>> convenient for offline use, where a resource might not necessarily be in<br>> the offline cache but you could use it if it happened to be available.<br><br>Interesting. This isn't covered yet, should we add it immediately?
</blockquote><div><br>I think it should be added *somewhere*, but it doesn't have to be part of the offline spec itself (although it is particularly useful when you're offline).<br><br>We have an experimental implementation:
<br><a href="http://mxr.mozilla.org/seamonkey/source/dom/public/idl/base/nsIDOMClientInformation.idl#55">http://mxr.mozilla.org/seamonkey/source/dom/public/idl/base/nsIDOMClientInformation.idl#55</a><br>That's ... underdocumented ... but the idea is this:
<br><pre lang="en"><a class="ident" href="http://mxr.mozilla.org/seamonkey/ident?i=boolean">boolean</a> <a class="ident" href="http://mxr.mozilla.org/seamonkey/ident?i=isLocallyAvailable">isLocallyAvailable</a>(<span class="atom">
in</span> <a class="ident" href="http://mxr.mozilla.org/seamonkey/ident?i=DOMString">DOMString</a> <a class="ident" href="http://mxr.mozilla.org/seamonkey/ident?i=uri">uri</a>, <span class="atom">in</span> <a class="ident" href="http://mxr.mozilla.org/seamonkey/ident?i=boolean">
boolean</a> <span class="atom">whenOffline</span>);<br></pre></div>It should return true when the browser will load the resource given by the URI without contacting the network. If 'whenOffline' is true then this putative load is assumed to happen while the browser is offline/using its offline caching functionality, if any. This is intended to allow an app to predict, while the user is online, what loads will succeed when the user goes offline, and in Gecko, for example, we do not perform HTTP cache validation while the browser is in offline mode, so a page might be locally available in offline mode but not in online mode. But we could probably get rid of this parameter if people think it doesn't make sense.
<br><br></div>Rob<br>-- <br>"Two men owed money to a certain moneylender. One owed him five hundred denarii, and the other fifty. Neither of them had the money to pay him back, so he canceled the debts of both. Now which of them will love him more?" Simon replied, "I suppose the one who had the bigger debt canceled." "You have judged correctly," Jesus said. [Luke 7:41-43]