 |

PPC>
Web
building>
Getting Started
Making your site Cross-Browser
David Dorn looks at one or two bits of HTML
that might trip up readers of your site.
As much as Microsoft would like you to think that
Internet Explorer is all you need to cater for when you’re creating
a Web site, that’s not quite the case. In the real world, there a
reporbably more browsers than you can shake a stick at, but the
following figures may prove interesting:
Taken from statistics for April 2002, these show the
relative quantities of hits from the various browsers used by
visitors to counter-enabled sites:
|
1. MSIE 5.x |
222,190,239 |
|
2. MSIE 6.x |
130,460,539 |
|
3. Netscape 4.x |
17,818,604 |
|
4. MSIE 4.x |
14,252,172 |
|
5. Netscape comp. |
4,278,541 |
|
6. Netscape 6.x |
3,553,751 |
|
7. Opera x.x |
2,990,936 |
|
8. Unknown |
1,927,854 |
|
9. Netscape 5.x |
732,263 |
|
10. Netscape 3.x |
285,400 |
|
11. MSIE 3.x |
273,302 |
|
12. MSIE 2.x |
251,936 |
|
13. Netscape 2.x |
17,683 |
|
14. MSIE 1.x |
620 |
|
15. Netscape 1.x |
599 |
While it’s obvious that Internet Explorer at version
5 and above has the lion’s share, there’s a very significant
proportion of users that don’t use Microsoft’s offering.
Different
The thing is, each of these browsers handle HTML in
a different way – even IE handles HTML differently from version to
version, so version 6 specific functions won’t be seen correctly in
version 4 or version 3 of the same application – and a Mac version
of IE renders pages very differently from a PC version, even
of the same version number.
What that means for you, as a Web author, is that
you need to take into account the relative levels of use of various
browsers on your site. If you discover that a lot less than 1% of
your visitors use a specific browser, then you may decide that it’s
not worth catering for them specifically. The same can be said of a
cutoff proportion of around 5% - which is the figure a lot of
commercial sites use.
In my opinion (probably not so humble), you’re
better off coding for 100% of your visitors – that way it doesn’t
matter what browser they’re using – they get to see your site in al
its glory all the time.
Problems
While that’s a laudable sentiment, in practice it’s
not really possible to do it without causing yourself problems in
terms of the look and feel of the site. For instance, take
JavaScript. Of all of the readers of Practical PC, there’s actually
a small percentage (it amounts to an awful lot less than 1% - closer
to 0.01% actually) that have turned off JavaScript functionality in
the AOL software altogether.
That means that there’s a large chunk of carefully
crafted HTML code they’re never going to be able to see. As it
happens, it won’t affect the content they see until they get to the
JavaScript section of the magazine, at which point they’ll see very
little – and obviously none of the examples. Strangely enough, I
note that one or two JavaScript incapable browsers do actually go
there – although why they do escapes me completely!
There are problems with Tables as well – Netscape,
for instance, handles tables differently from IE, in that pre
version 6 Netscape browsers won’t all ow an empty cell in a table –
it must have a character in it, even if it’s just a paragraph marker
(the <p> </p> pair). IE, on the other hand, allows an empty cell. If
you’ve coded for IE, then, your table won’t work in Netscape, and
your page will look awful.
What’s the answer?
Unfortunately, there’s no one answer, other than to
construct a very bland looking site that sticks rigidly to very
basic HTML code that’s compatible with every browser known to man.
However, when you’re cutting and pasting JavaScript code, look for
snippets that are cross-browser, or degrade well when used in a
browser other than their intended target.
If you’re going to go the degrade route, then only
use the JavaScript for something that’s not important to your page
(and if you’re going to do that, there’s no real point in using it
at all).
If you code for Netscape browsers without using
Netscape specific extensions, then everything you write will
work perfectly well in Microsoft browsers – so that’s one pointer
worthy of note.
Aside from that, you should check, if possible, that
what you’ve authored works as well in Netscape as it does in IE –
and it’s a simple matter to have both resident on your PC’s hard
disk. It’s what I do all the time, just to be sure that I’m
alienating as few visitors as possible.
|