سؤال

I am using prefetch/prerender on an HTML page.

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

I want to delay this action using JS.

هل كانت مفيدة؟

المحلول

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
); 
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top