JavaScript
  Home arrow JavaScript arrow Exception Handling in JavaScript: Addressi...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Exception Handling in JavaScript: Addressing Browser Incompatibilities
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 5
    2005-10-11

    Table of Contents:
  • Exception Handling in JavaScript: Addressing Browser Incompatibilities
  • JavaScript-based http requests: implementing cross-browser object instantiation
  • Cross-browser object instantiation: browser detection through exceptions
  • Proprietary event handlers: implementing browser-independent event handling
  • Assigning events to objects: using exceptions to manipulate event handlers

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Exception Handling in JavaScript: Addressing Browser Incompatibilities


    (Page 1 of 5 )

    Not all browsers handle all code the same way. Differences can be addressed with JavaScript exceptions. These may not be the best way under all circumstances, but you'll find it worthwhile to examine this approach.

    Introduction

    Welcome to the last part of the series “Exception Handling in JavaScript.” As you might guess, I’m winding up this tutorial focused on exploring the huge terrain of JavaScript exceptions, by running through numerous examples about their application in real client programs. Indeed, the topic is by far more extensive than can be treated in a few articles, thus complete coverage is nearly impossible. However, I’ve explained in a friendly way the basics of exceptions, by introducing their core concepts as well as their direct implementation in concrete cases.

    With reference to a practical application, in my previous article I offered an introduction to using custom error objects in a classic situation -- client-side form validation -- by tackling the issue from a different point of view, certainly distinct from traditional form verification techniques. Whether you use JavaScript as part of overall data validation processes (remember that server-side checking is a must), or simply for adding pre-defined behaviors to the structure of web documents, exceptions can be used to handle errors in a more professional way, by utilizing popular “try-catch” blocks.

    Since most of the examples that I’ve shown through this series are aimed at providing you with the required background to use exceptions in practical cases, over this last part I’ll continue sticking to that approach by demonstrating particularly how some browser incompatibilities can be addressed with exceptions. Of course, I’m not claiming this method is the best way to deal with all browser inconsistencies, but certainly it does offer an alternative method that’s worth reviewing.

    Now that you know what this last part of the series is about, let’s see a few examples that use exceptions for solving some browser-related incompatibilities.

    More JavaScript Articles
    More By Alejandro Gervasio


       · The last part of the series uses JavaScript exceptions for addressing some browser...
       · Wouldn't you agree that exceptions are not for a regular control flow and should be...
       · Thank you for posting your comments on my JavaScript article. Yeap, I agree with you...
     

    JAVASCRIPT ARTICLES

    - Validating Digits and Dates with jQuery`s Va...
    - Validating Ranges, Emails, and URLs with jQu...
    - More Uses for the jQuery Tooltip Plug-in`s b...
    - Building Image-Based Tooltips with the jQuer...
    - Using the jQuery Tooltip Plug-in`s bodyHandl...
    - Using Rangelength, Min and Max with the Vali...
    - Using Minlength and Maxlength with the Valid...
    - Modifying Tooltip Coordinates with the jQuer...
    - Applying a Fade Out Effect with the jQuery T...
    - Tracking Mouse Movements with the jQuery Too...
    - Checking Online Forms with the Validator jQu...
    - Nested JavaScript Functions as Objects
    - The jQuery Tooltip Plug-in
    - Active Client Pages at the Server
    - ACP Tab Web Page







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT