[Javascript] RES: (no subject)

liorean liorean at gmail.com
Thu Aug 30 20:57:03 CDT 2007


On 31/08/2007, David Hucklesby <davidh126 at writeme.com> wrote:
> On Wed, 29 Aug 2007 17:01:48 -0700, Hassan Schroeder wrote:
> >
> > Bad enough to find out now that more browsers than just IE support document.all :-)
>
> If you need to detect IE, you could use something like:
>
> if (typeof element.style.filter == 'string') ...
>
> where "element" is some DOM element or other.

Or you could use something like this (unnecessarily complex example
since you only need a single variable, but still):

    var
        iew=false,
        jscript=false;
    /*@cc_on
      @if (@_win32)
        iew=true;
      @end
      @cc_on
      @if (@_jscript)
        jscript=@_jscript_version;
      @end @*/

It isn't really detecting the right thing since it's really detecting
support for JScript type conditional compilation (not spoofed by any
other browser), JScript and Win32 platform, but you can use it to
detect browser versions if you really need. JScript version tells you
what browser... ie6 has version 5.6, ie7 has 5.7.
-- 
David "liorean" Andersson



More information about the Javascript mailing list