[Javascript] Object Detection using Javascript.

Hakan M (Backbase) hakan at backbase.com
Fri Sep 24 04:45:06 CDT 2004


You might find this handy:

bOpera6  = (!document.createComment && window.opera);
bOpera7  = (document.createComment && window.opera);
bIE5     = (document.all && !document.fireEvent && !window.opera);
bIE55    = (document.all && document.fireEvent && 
!document.createComment && !window.opera);
bIE6     = (document.all && document.fireEvent && document.createComment);
bMozilla = (window.controllers);

The only way I have (right now) to detect Safari is through the UA, I'm 
afraid.

bSaf     = (navigator.userAgent.toLowerCase().indexOf('safari') != -1);
bSaf12   = (bSaf && (navigator.productSub > 20030107));

All newlines are denoted with a semicolon.

Regards,
H

Ben Crane wrote:
> Hi all,
> 
> Me again, when there's one there's usually more
> questions. :)
> 
> I want to do a browser check using Javascript objects
> to determine Opera, IE, Netscape, Safari, etc. but
> can't find any information or websites that cover that
> javascript objects are not covered by which website. I
> can find stuff on IE and Netscape (mainly for versions
> 3/4) but I'd like a more comprehensive list? Does
> anyone know where I can find one? I have tried looking
> under what DOM objects are not support by each browser
> but it tends to be a dead end.
> 
> The reason I ask is that I use div tags (with
> overflow:scroll / hidden) for IE and NS, but since
> Opera doesn't cover overflow:scroll or hidden) I need
> to know what browsers are opening up my webpage so I
> can assign the appropriate CSS or disable Javascript.
> I have thought about using javsacript to create a
> scrollable textbox such as the one Zscrollbar I
> found-but I don't know how to create one and kinda
> want to do it myself.
> 
> Regards
> Ben
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 




More information about the Javascript mailing list