MCPcopy Index your code
hub / github.com/ampproject/amphtml / warmupStatic

Function warmupStatic

ads/alp/handler.js:163–174  ·  view source on GitHub ↗
(win)

Source from the content-addressed store, hash-verified

161 * @param {!Window} win
162 */
163export function warmupStatic(win) {
164 // Preconnect using an image, because that works on all browsers.
165 // The image has a 1 minute cache time to avoid duplicate
166 // preconnects.
167 new win.Image().src = `${urls.cdn}/preconnect.gif`;
168 // Preload the primary AMP JS that is render blocking.
169 const linkRel = /*OK*/ document.createElement('link');
170 linkRel.rel = 'preload';
171 linkRel.setAttribute('as', 'script');
172 linkRel.href = `${urls.cdn}/v0.js`;
173 getHeadOrFallback(win.document).appendChild(linkRel);
174}
175
176/**
177 * For events (such as touch events) that point to an eligible URL, preload

Callers 2

install-alp.jsFile · 0.90

Calls 2

getHeadOrFallbackFunction · 0.85
setAttributeMethod · 0.45

Tested by

no test coverage detected