3

I'm working on a website that has some high quality images that need to load. Of course, my goal is to get the site to load as quickly as possible so we don't slow down the user experience and I don't take a page rank hit for being a slow loading website.

I'd like to initially load a low quality version of the pictures so the page loads quickly and then enhance them with a second wave of downloads using JavaScript after the page has completely loaded.

I know I can detect when the page has loaded using jQuery ready() but I want to make sure Google considers the page loaded before I start enhancing things. I'm worried that if I keep adding content with ready(), Google will think the page load is still happening and penalize me for a slowly loading page.

So, another way to ask this question is "When does Google consider the page loaded and when can I start adding more elements without Google thinking it's still part of the initial page load?"

1 Answer 1

5

If you want to know when the page has fully loaded, then you need to use the window.onload (or $(window).load()) event, not jQuery's $(document).ready() event.

$(document).ready() is triggered as soon as the HTML document has finished downloading and the DOM is ready. But the images and other resources aren't done loading at this point.

If you want to know how Google sees your page's performance, PageSpeed Insights would be a good place to start. PageSpeed measures the loading time of your page starting from the initial request to when the last embedded resource (JS, CSS, images, etc.) has finished loading.

So that's essentially when $(window).load() is triggered.

2
  • 1
    So, if I add script to $(window).load() Google won't consider that part of the page load? Theoretically speaking, the code in .load() can run for minutes and it won't matter? Also, I tried PageSpeed Insignts but I couldn't find the actual load time of the page, just the overall score. Pingdom has a good tool for load time tools.pingdom.com/fpt but I want to make sure I know exactly what Google thinks. Commented Dec 31, 2012 at 3:57
  • 1
    @Michael: Yes, if you have the script running on the $(window).load() event, then Google won't add its runtime to the page load. Are you using the PageSpeed Insights browser plugin or the web-based test? If you want to see the breakdown for the web-based test, you have to click on "Critical Path Explorer" after you've analyzed the page in PageSpeed Insights. Commented Dec 31, 2012 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.