Google Cache and slow CSS

If you use Google Cache when a server isn't responding, and the page uses an external style sheet, you won't be able to see the cached page. The reason is that most browsers block page display while waiting for the style sheet to load, and Google doesn't cache CSS or images. This limits the usefulness of Google's cache, especially now that CSS is popular.

Google could cache CSS along with HTML. To avoid spidering and storing every page's CSS, Google could proxy CSS loads for Google Cache users, and have the proxy time out after 5 seconds. But both of these solutions might use a lot of bandwidth.

Google could add code to cache pages to make CSS load later or in a non-blocking fashion. This has the disadvantage that when the server is responding, the page will be presented unstyled for a split-second. Since some Google users use the cache even when the site isn't down, this would be bad.

I hoped there would be a way for Google to add code to cache pages to stop blocking loads that are taking too long. JavaScript can detect a slow load: call setTimeout above the LINK element, and call clearTimeout in another SCRIPT element below the LINK. But the function setTimeout activates can't cancel the load by disabling the style sheet, changing the LINK's href, or removing the LINK element from the document. Browser makers didn't anticipate JS trying to cancel a blocking load. (Removing the LINK element from the document even crashes IE.)

Another solution is for browsers to make CSS loads block less:

  • 84582#c11 - CSS loads should stop blocking layout if they take more than a few seconds
  • 220142 - Pressing Stop while waiting for CSS should finish displaying what has been loaded before stopping.
  • 224029 - JS can't cancel blocking load of a style sheet

2 Responses to “Google Cache and slow CSS”

  1. alanjstr Says:

    Completely unrelated to today’s post: Have you considered changing your RSS feed to 2.0?

    It would solve your Category problem, I think.

  2. Jesse Ruderman Says:

    Google Cache pages have a link:

    “This cached page may reference images which are no longer available. Click here for the cached text only.”

    Clicking that link strips stylesheets in addition to images, so it is a good workaround for Mozilla users who figure out that they should cilck the link. IE has poorer incremental rendering, so IE users can’t even see that link until the stylesheet load times out.

    Opera 7.54 seems to avoid this problem entirely — I can see a cached page in Opera in about 1 second that I can’t see in Mozilla or Internet Explorer for about half a minute. I wonder if it takes an approach like or does something else.