Page #64 (Chapter 9 - Dealing with Multiple Browsers)

Chapter 9 - Dealing with Multiple Browsers

Visual Basic Developers Guide to ASP and IIS
A. Russell Jones
  Copyright 1999 SYBEX Inc.

Understanding Differences between Browsers
Not all browsers are the same, but they have some base-level capabilities that you can count on. For example, all modern browsers can display HTML version 3.2, and all modern browsers can display frames. Frames became available when Netscape released version 2 of its Navigator browser.
I'm not going to discuss browsers earlier than Netscape/IE version 2, although you might find a few still active on the Web. A few stubborn souls still surf the Web in text mode, but most people have realized that they're missing a large part of the Web experience by sticking to obsolete browser technology. I've found that most people upgrade relatively quickly when new versions become available.
Despite the universality and standard syntax of HTML, browsers differ in the quality of the HTML that they will accept and in the way that they display the information. Although important, the HTML differences in browsers through version 3.x were relatively small—Netscape and IE had a few proprietary tags. But starting with version 4.x browsers, the differences became huge—primarily because IE 4 included a much more complete implementation of dynamic HTML and cascading style sheet technology.
In addition to HTML tags, major differences exist in the capabilities of the two companies' browsers. Table 9.1 shows some of the most important differences in the version 4.x browsers.
Table 9.1: Comparison of Netscape and Internet Explorer Browser Features
Feature
Netscape
Internet Explorer
Inline frames
No
Yes
JavaScript
Yes
Yes (ECMAscript, JScript)
VBScript
No
Yes
ActiveX DLLs
No native support—available through third-party plug-ins
Yes
Java applets
Yes
Yes
Absolute positioning
Yes (with layers)
Yes
Functional buttons outside of forms
No
Yes
Viewing of documents other than HTML
No
Yes, all ActiveX documents (most Microsoft Office documents)
Script binding
No
Yes
Data binding
No
Yes
As you can see—and as you would expect—Microsoft's implementation is tightly bound to Windows and COM technology. IE can directly display almost any Microsoft Office document in the browser. The appropriate application merges its menus and toolbars with the IE menus and toolbars. This lets you browse Word, Excel, and PowerPoint files in the same way that you browse HTML files. You also need to be aware of the client browser's capabilities if you begin sending client-side script, dynamic HTML, or, in general, any code that executes on the client rather than on the server.
Fortunately, WebClasses, like ASP files, execute entirely on the server. If the client browser is IE, you can use ActiveX technology or Java; if it's Netscape, you can use Java. The main point is that whichever browser the client is using won't directly affect your WebClass code. The browser type affects only what happens with the response that your WebClass returns.
Consequently, the job of the WebClass is to determine which browser the client is using, then to format a response appropriate for that browser.
Before you go any further, I should warn you that one part of WebClass development is directly related to browser type—the HTML templates. Unless you're delivering to a specific browser type, you should use a platform-neutral HTML editor. Failing that, write the HTML as strings concatenated with VB code. It's difficult to write code to parse the HTML template text and reformat it for one browser or another at runtime. You can select a template based on browser type, but you'll have to write two sets of separate-but-identical methods in your WebClass or put all the logic into subroutines and functions. You can't just substitute one template for another in the current implementation.



Visual Basic Developer[ap]s Guide to ASP and IIS
Visual Basic Developer[ap]s Guide to ASP and IIS
ISBN: 782125573
EAN: N/A
Year: 2005
Pages: 98

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net