I'm changing the dns-prefetching href with javascript. I want to know if it is effective. I'have 2 website that share the same javascript.
So i do something like this:
<link id="prefetching" href="//www.site1.com" rel="dns-prefetch" />
var currentDomain = document.domain;
if (currentDomain.contains("site1")) {
$("prefetching").href = currentDomain.replace("site1", "site2");
return;
}
if (currentDomain.contains("site2")) {
$("prefetching").href = currentDomain.replace("site2", "site1");
return;
}