Re: [slightlyoff/ServiceWorker] Handling race conditions - API for accessing pending requests? (#959)

> I think the answer in both cases is that the HTTP cache will help avoid actually issuing double requests over the network and that this simplifies things for everyone.

Would this necessarily be true if the first request hasn't completed yet? At what stage does an object get put in the http cache?

> What's the benefit of doing this manually rather than <link rel="prefetch"> or <link rel="prerender">?

I didn't realise they were more widely supported than preload, and they could be a good option (although prerender is still missing in firefox, and who knows in which order safari might implement sw & pre* link headers). 

If I fetch /page1.html and it has a link header `</page2.html>; rel=prefetch`, and page2.html has a link header `</main.css>; rel=preload`, will main.css get downloaded?

If not, it'd be useful to have something between the two - prefetch-with-linked-resources. Prerender is a bit extreme sometimes e.g. one potential use case is to prefetch all stories featured on the home page - I will want to fetch all the html files and their styles and scripts, but won't want to expend resources on background render for each of them.

One other reason to not simply use link headers is that some of these prefetches may be based on user recommendations/interactions on the page, so information about them won't be carried in the page's link headers e.g. a user clicks on a 'make this article available offline button', and then navigates to the page fairly quickly.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/959#issuecomment-240660732

Received on Thursday, 18 August 2016 08:43:13 UTC