Welcome!

Kurt Cagle

Subscribe to Kurt Cagle: eMailAlertsEmail Alerts
Get Kurt Cagle via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: RIA Developer's Journal, AJAX World RIA Conference

RIA & Ajax: Article

Real-World AJAX Book Preview: Understanding Browser Differences

Real-World AJAX Book Preview: Understanding Browser Differences

This content is reprinted from Real-World AJAX: Secrets of the Masters published by SYS-CON Books. To order the entire book now along with companion DVDs for the special pre-order price, click here for more information. Aimed at everyone from enterprise developers to self-taught scripters, Real-World AJAX: Secrets of the Masters is the perfect book for anyone who wants to start developing AJAX applications.

Understanding Browser Differences
There's an interesting phenomenon going on right now. Several of the critical technologies used by AJAX first appeared in Microsoft's Internet Explorer, which still has a large (though diminishing) market share according to most statistics.

However, it was largely the appearance of certain AJAX tools in Mozilla's Firefox that opened the floodgates to AJAX applications, and most browsers since then have largely opted for the Mozilla interface models in developing their own core API. For this reason, when dealing with AJAX it's generally necessary to work with both sets of syntax, though there are indications in Internet Explorer 7.0 that Microsoft is also moving toward a more Mozilla-oriented interface, especially in light of recent limitations on how embedded controls operate in the browser.

In general, Mozilla components are intrinsic to the JavaScript model - you can work with such things as the XMLHttpRequest object (a principle part of AJAX) just by using the expression:

var http = new XMLHttpRequest();

Mozilla supports a core component model binding called XPCOM that is actually used in background to instantiate the interfaces for these objects under Mozilla, but all of the objects and methods used in this book use only the pre-declared objects.

Microsoft's Internet Explorer, on the other hand, uses the ActiveXObject "object" to instantiate objects using MSCOM. This ActiveX model works by passing a classID to the object and returns the object with its associated interfaces, which can be referenced from within JavaScript:

var http = new ActiveXObject("Microsoft.XMLHTTP");

This is a little more problematic since such ActiveX objects can trigger security warnings and may not be workable in certain higher-security contexts. For the objects covered in this chapter, this is generally less of an issue since they're all are designed to work in the browser context.

Internet Explorer 7.0 looks like it's moving towards an object model for additional components where these objects are "intrinsic" - pre-declared - and there is some movement towards consolidating AJAX components in a common API with Mozilla, but that movement is occurring fairly slowly.

This content is reprinted from Real-World AJAX: Secrets of the Masters published by SYS-CON Books. To order the entire book now along with companion DVDs, click here to order.

More Stories By Kurt Cagle

Kurt Cagle is a developer and author, with nearly 20 books to his name and several dozen articles. He writes about Web technologies, open source, Java, and .NET programming issues. He has also worked with Microsoft and others to develop white papers on these technologies. He is the owner of Cagle Communications and a co-author of Real-World AJAX: Secrets of the Masters (SYS-CON books, 2006).

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.