Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Image rollovers: Netscape and MSIE, but others?

3 views
Skip to first unread message

Anthony Boyd

unread,
Dec 15, 1997, 3:00:00 AM12/15/97
to

Greg Berigan <gber...@cse.unl.edu> wrote:

> I've been given the task of updating existing image rollover JavaScript
> that originally allowed only Navigator 3.0 and later access but not any
> access from MSIE browsers. I've learned how to detect the browsers and
> versions and even the special case of Mac MSIE 3.02 which also supports
> image rollovers (are there others), but I'm faced with a problem:
>
> I'd rather not create a situation where this whole updating thing needs
> to be done again and again as more browsers come with JavaScript and
> image rollovers working first time out. If I go with testing only if
> the browser is one that is known to support them, I cut off future
> compatible browsers. Can I code the pages so that the primary
> assumption is that support IS present and then turn it off if Netscape
> pre-3.0 or MSIE pre-4.0 (modulo Mac MSIE pre-3.02) is detected?

Ugh. Don't do that. Browser detection is a last resort. Always use
object detection if possible. Like this:

if (document.images) {
image swapping code
}

Then, any current or future browser that can handle the image object will
execute that code, and the browser that cannot, will not.

> Do any other browsers currently support JavaScript, do they support the
> image object, and if not, would failure to block them from running the
> code cause them serious problems?

Sure. Lots. You already know about IE and Nav. Opera also does
JavaScript and the image object. So does WebTV. Cyberdog does not, but
was slated to get a revision that would allow it to do so. TradeWave's
Web site was touting their WinWeb and MacWeb browsers as supporting
JavaScript, but that was a while back, and since they only sell to big
corporate customers, I've never seen it. Spyglass Mosaic was also rumored
to be getting JavaScript capabilities, but I haven't ever seen that
browser.

-Anthony Boyd
www.borland.com

Greg Berigan

unread,
Dec 16, 1997, 3:00:00 AM12/16/97
to

I've been given the task of updating existing image rollover JavaScript
that originally allowed only Navigator 3.0 and later access but not any
access from MSIE browsers. I've learned how to detect the browsers and
versions and even the special case of Mac MSIE 3.02 which also supports
image rollovers (are there others), but I'm faced with a problem:

I'd rather not create a situation where this whole updating thing needs
to be done again and again as more browsers come with JavaScript and
image rollovers working first time out. If I go with testing only if
the browser is one that is known to support them, I cut off future
compatible browsers. Can I code the pages so that the primary
assumption is that support IS present and then turn it off if Netscape
pre-3.0 or MSIE pre-4.0 (modulo Mac MSIE pre-3.02) is detected?

Do any other browsers currently support JavaScript, do they support the


image object, and if not, would failure to block them from running the

code cause them serious problems? I'd prefer to err on the side of
admittance of these future browsers rather than block them. If I block
them, the scripts may never get modified again to allow them, but if
allowing them causes problems, it is more likely the scripts will get
changed to block the troubled versions.

--
_-<#)-=# http://cse.unl.edu/~gberigan/War-of-the-Worlds/
___/___
_-~_--<###) Due to widespread abuse, I no longer read any messages
<~c>' __--< from users who employ munged addresses in their headers.
\_--=____#) "We've upped our standards, so up yours." -- Pat Paulsen '88

JustYaz

unread,
Dec 16, 1997, 3:00:00 AM12/16/97
to

>I'd rather not create a situation where this whole updating thing needs
>to be done again and again as more browsers come with JavaScript and
>image rollovers working first time out. If I go with testing only if
>the browser is one that is known to support them, I cut off future
>compatible browsers. Can I code the pages so that the primary
>assumption is that support IS present and then turn it off if Netscape
>pre-3.0 or MSIE pre-4.0 (modulo Mac MSIE pre-3.02) is detected?

You can try using
if(document.images) {
// image stuff here
}
as opposed to trying to test for browser type and version. As far as I know
this should not have any problems in any browser. If it does please feel
free to correct me.

Greg Berigan

unread,
Dec 16, 1997, 3:00:00 AM12/16/97
to

jus...@aol.com (JustYaz) wrote:

> You can try using
> if (document.images) {


> // image stuff here
> }
> as opposed to trying to test for browser type and version. As far as I know
> this should not have any problems in any browser. If it does please feel
> free to correct me.

Oh, thank you! Looking at the pre-existing code and other discussions
here I thought testing for browsers was the only alternative. With this I
should never have to modify the scripts again for new incompatibilies.
Thank you for your help, as well as all other respondents.

0 new messages