subresource and prefetch

both seems would try cache first, then http request if not yet cached.

At the same time, subresource could result in duplicate http retrieval, if same resources (eg. image) initiated again from another (eg.css). Because, subresource always force to download.

While, as prefetch is low priority, since it’s supposed for next page. So it waits for current page loading finish. And prefetch could be cancelled by subresource or any other initiation of same resource.

for example, with below source code:

<!-- below would be reinitiated/requested by css later -->
<link rel="subresource" href="images/header_brs.jpg" />
<link rel="subresource" href="images/float_bar_lg.gif" />
<link rel="prefetch" href="images/grad.jpg" />
<link rel="prefetch" href="images/brs_C.jpg" />
<!-- JS for next page -->
<link rel="prefetch" href="js/summaryPage.js" />
<link rel="subresource" href="js/summaryPage.js" />

it would render as below






Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s