Current time: 01-26-2021, 07:42 PM Hello There, Guest! (LoginRegister)

Post Reply 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dns-prefetch. Anyone familiar?
04-12-2012, 03:47 AM (This post was last modified: 04-12-2012 04:17 AM by p83822.)
Post: #7
RE: dns-prefetch. Anyone familiar?
    I thought I'd have another look at this, now that dns-prefetch is official HTML5. I ran the following in FF (because I know how to disable FF's dns cache.) (And yes, this is truly vile!)

My expectation was that the look ahead preparser would recognise and as being in the html, but would not recognise as it is in the JS. My understanding being that look ahead preparsers do not read JS.

To my surprise, the DNS lookup for occurs after the sleep. (VRTA graphs this beautifully - see attached.) Pic1 is with dns-prefetch tags commented out, Pic2 with them in.

The horrid code?. Enjoy:

<meta charset="utf-8">
<!--<link rel="dns-prefetch" href="//">
<link rel="dns-prefetch" href="//">
<link rel="dns-prefetch" href="//">-->

<img src=''/>

<script type="">
(function() {
var startTime = new Date().getTime();
while (new Date().getTime() < startTime + 1000);

<img src=''/>

<script type="text/javascript">
(function() {
var d = function() {
var img = document.createElement("img");
img.src = "";
var s0 = document.getElementsByTagName('script')[0];
s0.parentNode.insertBefore(img, s0);
setTimeout(d, 1000);
Daftness. Nothing will happen during the sleep. D'oh! Nice to know that the prefetch directive now though.

Attached File(s) Image(s)
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
dns-prefetch. Anyone familiar? - p83822 - 02-15-2010, 08:25 PM
RE: dns-prefetch. Anyone familiar? - p83822 - 04-12-2012 03:47 AM
RE: dns-prefetch. Anyone familiar? - pqdbr - 04-17-2012, 02:59 PM

Forum Jump:

User(s) browsing this thread: 1 Guest(s)