How a browser really really works

How a browser really really works.

David Hyatt, lead developer for Apple's Safari web browser talks about how Safari and Mozilla renders web pages, and the algorithms it uses to render partially downloaded data. Interesting if you are a HTML jock.

A few tips I gleaned:

  • Only use one CSS file and make sure that the link to it is at the
    top of the web page. This is because all CSS has to be loaded before
    any rendering can properly occur. The browser might attempt to draw
    something before all the CSS arrives, but an unsightly white flash will
    occur as a redraw will have to be made as soon as the rest of the CSS
    arrives.

  • Adding a defer attribute in the script tag like this
      

    speeds up rendering. This is because Javascript's document.write()
    function can dynamically generate HTML, and the defer attribute
    prevents this, allowing the browser to optimize javascript execution by
    deferring it, after HTML rendering.

<>
It also shows that a properly implemented browser rendering pipeline will significantly benefit from multi-core processors and hyperthreading. Does anyone know whether these browsers take advantage of this? [PHP Everywhere – Thoughts on PHP and other programming technologies by John Lim]

Leave a comment