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
);
Question
I am using prefetch/prerender on an HTML page.
<link rel="prefetch" href="example.com" />
I want to delay this action using JS.
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
);