开发者

What prevents HTML pages from taking advantage of progressive rendering?

开发者 https://www.devze.com 2023-02-03 12:18 出处:网络
I\'ve notice that some pages begin to render almost immediately, while others sometime have to wait until many or all of the resources (javascript, i开发者_Go百科mage, css) have been downloaded. The w

I've notice that some pages begin to render almost immediately, while others sometime have to wait until many or all of the resources (javascript, i开发者_Go百科mage, css) have been downloaded. The worst case seems to be for a large page, on a slow connection or server. One specific page I'm looking at comes out to almost 2 MB, with 30 different .js files, a dozen .css files, and 80 image.

I'm aware of the suggestions at http://developer.yahoo.com/performance/rules.html, but what would be preventing the browser from attempting to render the page until the last element has been downloaded?


There are a handful of reasons why this may happen. The most common that I see are large tables.

For example, Internet Explorer doesn't like to render a table until it is finished loading.

Each browser is a bit different though, in how they render things that are still downloading.


The general rule is to not use tags about structure to affect layout. With the styles at the start of a page a rendering engine knows what it has to do to render a certain part of the page, but it always has to wait for a part to download to know how to render it properly.

With that in mind:

  1. Tables should rearely (never?) be used for layout purposes.
  2. Parts that should be reasonably rendered first (sidebars, toolbars, and anything that framews the page) should be featured at the top of the HTML document.

The huge JavaScript libraries in use today are different in that they only need to be loaded (and cached) once.

0

精彩评论

暂无评论...
验证码 换一张
取 消