Вопрос

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