Newbee to Web-programming

Discussion in 'Javascript' started by Andy, Oct 5, 2004.

  1. Andy

    Andy Guest

    After the server processes the page, the server sends a rendered
    HTML/text/Script client-side code down to the browser. I'm wondering
    how (in what order) does the browser interpret the text document. Does
    the browser do the HTML first and then anything between the script
    tags or is it the other way around. What would be the sequence of
    events in IE and in Netscape?

    I would appreciate if someone can shed some light on this.

    Thank you,
    Andy, Oct 5, 2004
    1. Advertisements

  2. Andy

    Randy Webb Guest

    Unless explicitly told to do it differently, it processes it in the
    order its sent to the browser.
    Randy Webb, Oct 5, 2004
    1. Advertisements

  3. Generally, the browser parses the HTML from the begining, and when it
    meets a script element, it executes the script at that point. That is
    why "document.write" inserts its content right after the script

    Accessing parts of the page already parsed, might be possible, but
    since the DOM has not been fully build, I would not feel absolutely
    certain about accessing it before the page has loaded.

    If you give a script element the attribute "defer", then the browser
    is allowed to defer execution of that script until later, but no later
    than the execution of the next script element on the page.
    I believe they agree completely about the order, as does all other
    scriptable browsers.

    Lasse Reichstein Nielsen, Oct 5, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.