When prefetching images, why do I need the "if (document.images)" statement?
Not all browsers support document.images (object). Trying to access it
would blow up unsupporting browsers (IIRC, Lynx has no such construct
nor do very old versions of netscape). The test returns true only for
browsers that have the object.
Basically, this is referred to as degrading gracefully (that is, the
code won't work "right" for unsupporting browsers, but it won't kill
them with errors, either).
All your code should have such constructs if you're coding for the
internet. You just don't know what browsers people are using. New
browsers come out frequently enough that browser detection is a horrid
idea (plus there's a lot you've probably never heard of). So, object
detection, which is what this is, is the better way to go.
--
--
~kaeli~
It was recently discovered that research causes cancer in
rats.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace