-
Notifications
You must be signed in to change notification settings - Fork 143
Preload links can be sent via Link HTTP response headers over HTML link tags #1321
Description
As noted in the web.dev article, Preload critical assets to improve loading speed, sending the preload links via Link HTTP response headers has a slight performance advantage over HTML link tags:
You can also preload any type of resource via the Link HTTP header:
Link: </css/style.css>; rel="preload"; as="style"A benefit of specifying preload in the HTTP Header is that the browser doesn't need to parse the document to discover it, which can offer small improvements in some cases.
Since Optimization Detective is output-buffering the page, this can be very straightforward to implement. Instead of (or rather in addition to) doing this:
performance/plugins/optimization-detective/optimization.php
Lines 192 to 195 in 2f2691a
| // Inject any preload links at the end of the HEAD. | |
| if ( count( $preload_links ) > 0 ) { | |
| $walker->append_head_html( $preload_links->get_html() ); | |
| } |
A new method can be added to OD_Preload_Link_Collection like send_headers() which can construct the Link response header and send it via header().
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackProjects
Status