Question

I am using prefetch/prerender on an HTML page.

<link rel="prefetch" href="example.com" />

I want to delay this action using JS.

Was it helpful?

Solution

Maybe try using setTimeout and document.write. Tested in chrome and it loads the site after 2s (saw in network panel)

window.setTimeout(function() {
    document.write("<link rel='prefetch' href='http://www.google.de' />")
    }
    ,2000
); 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top