Skip to content

Chapter 13: JavaScript in Web Browsers

March 2, 2012

This entry is a review of “Chapter 13: JavaScript in Web Browsers” from “JavaScript: The Definitive Guide”

This chapter introduces client-side JavaScript programming. It goes over the 4 different ways JavaScript can be included in a document, browser compatibility, the event-driven nature of JavaScript and briefly touches on some security issues like the Same Origin Policy and Cross-Site Scripting. It was pretty familiar territory, but a nice easy read. Below are my notes.

  • When a browser is parsing the “script” tag, if it doesn’t recognize the “type”, it ignores the contents of the script tag.
  • The script tag can have a defer and async parameter, these are a way of telling the browser that the script doesn’t contain document.write calls. deter means to defer execution until the document has been fully parsed, and async means to not block while the script is executed, but to download and execute it as soon as possible. If a script tag has both, async takes precedence.
  • Conditional Comments in IE – in addition to the HTML comments that are used, IE also has special JavaScript comments. Example:

    /*cc_on
    @if (@_jscript)
    // JS code only executed by IE
    alter("using IE");
    @end
    @*/

From → Chapters

Leave a Comment

Leave a comment