- From: Andrew Betts <andrew.betts@ft.com>
- Date: Mon, 24 Sep 2012 13:40:26 +0100
- To: Tobie Langel <tobie@fb.com>
- Cc: Jake Archibald <jaffathecake@gmail.com>, "public-fixing-appcache@w3.org" <public-fixing-appcache@w3.org>
>>On 24 September 2012 00:23, Andrew Betts <andrew.betts@ft.com> wrote: >>> I suspect the web solution is some form of the INTERCEPT idea. But I >>>still >>> don't see any way within the current proposal that a root URL could be >>> intercepted while other URLs on the same domain are not, because the >>> INTERCEPT syntax would treat '/' as a prefix. >> >>Good point. We need a case where... >> >>1. User hits http://app/path/to/something/* >>2. Cached page displays instantly, showing either cached data or >>custom loading screen >>3. Page makes XHR request to >>http://app/api/path/to/something/whatever.json >>4. Page is updated with fresh data from API response >> >>As you point out, this would require something like a global intercept >>that excludes /api/* > > Let's not get hung-up on syntax here. Isn't the rest of your message almost entirely about syntax?! > > There are multiple way an INTERCEPT-like solution could allow a subset of > requests to reach the network no matter what. > > For example, it an intercept-like solution was to be built in JavaScript > (e.g. in a SharedWorker): > > self.addEventListener('request', function(e) { > var pathname = e.url.pathname; > if (pathname === "/" || !(/$api\/.*/).test(pathname)) { > var responseBody = appCache.get(pathname); > if (responseBody) { > self.postResponse(responseBody); > // The default behavior is to get the resource from the > // network, so prevent it here as we found one. > e.preventDefault(); > } > } > }, false); > > If the intercept solution was to be built using AppCache manifest > semantics, it could be decided to create new semantics for prefix matches, > e.g.: > > NETWORK: > / # matches / only > /* # matches everything That would break backwards compatibility, assuming there is something using the existing support for INTERCEPT in chrome, but it would certainly solve the problem, as would the sharedworker solution albeit with security issues that would need to be addressed. Anyway, whatever it is that solves this problem, I say it's a problem that needs solving and is in scope. Tobie, are you still intending to write up these use cases? I feel like we're currently blocked on that and wonder if we can start to make progress in another direction, such as collating proposals. -- ------------------------------ This email was sent by a company owned by Pearson plc, registered office at 80 Strand, London WC2R 0RL. Registered in England and Wales with company number 53723.
Received on Monday, 24 September 2012 12:40:51 UTC