Created
March 16, 2016 20:14
-
-
Save okor/eff59b8bef13addcabd2 to your computer and use it in GitHub Desktop.
Measure impact of using prerender via Webpagetest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Because we aren't technically making the page render any faster, the page we navigate too isn't reporting | |
// a decrease in render/speedindex/etc, which makes sense. But how would you measure the affects of prerender? | |
// If I use this same injection strategy locally, give the prerender target page some lead time (a couple seconds or so) | |
// then the effect is a nearly instant perceived page load. But it's unclear to me how I can measure that. Halp. | |
// * These don't work * | |
// inject the prerender tag, give the target page a 1000ms lead time | |
// result: http://www.webpagetest.org/result/160316_13_cc82666824bc7c89a88336b60eaed1fa/ | |
logData 0 | |
navigate http://www.curbed.com/ | |
exec window.preTag = document.createElement('link'); | |
exec window.preTag.rel = "prerender"; | |
exec window.preTag.href = "http://www.curbed.com/2016/3/15/11234274/japan-earthquake-recovery-home-for-all"; | |
exec document.head.appendChild(preTag); | |
waitForJSDone setTimeout(function(){ window.webpagetest.done() }, 1000); | |
logData 1 | |
navigate http://www.curbed.com/2016/3/15/11234274/japan-earthquake-recovery-home-for-all | |
// inject the prerender tag, give the target page a 4000ms lead time | |
// result: http://www.webpagetest.org/result/160316_6N_bb6e961571757acaa650e1cf976480c7/ | |
logData 0 | |
navigate http://www.curbed.com/ | |
exec window.preTag = document.createElement('link'); | |
exec window.preTag.rel = "prerender"; | |
exec window.preTag.href = "http://www.curbed.com/2016/3/15/11234274/japan-earthquake-recovery-home-for-all"; | |
exec document.head.appendChild(preTag); | |
waitForJSDone setTimeout(function(){ window.webpagetest.done() }, 4000); | |
logData 1 | |
navigate http://www.curbed.com/2016/3/15/11234274/japan-earthquake-recovery-home-for-all | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment