Something a little bit more detailed

    public static native String getUserAgent() /*-{
                var ua = navigator.userAgent.toLowerCase();

                if (ua.indexOf("opera") != -1) {
                        return "opera";
                }
                if (ua.indexOf("webkit") != -1) {
                        return "safari";
                }
                if ((ua.indexOf("msie 6.0") != -1)
                ||  (ua.indexOf("msie 7.0") != -1)) {
                        return "ie6";
                }
                if (ua.indexOf("gecko") != -1) {
                        var result = /rv:([0-9]+)\.([0-9]+)/.exec(ua);
                        if (result && result.length == 3) {
                                var version = (parseInt(result[1]) * 10) +
parseInt(result[2]);
                                if (version >= 18)
                                        return "gecko1_8";
                        }
                        return "gecko";
                }
                return "unknown";
        }-*/;


2008/11/13 posta07 <[EMAIL PROTECTED]>

>
> I think this works...
>
>  public native static String getUserAgent() /*-{
>    return $wnd.navigator.userAgent.toLowerCase();
>    }-*/;
>
> On Nov 13, 1:17 pm, rjcarr <[EMAIL PROTECTED]> wrote:
> > Is there any way to get the browser type or family from within the
> > code?  I'm using LoadListeners and they don't behave very well in IE
> > and would like to do a quick check and react differently when in IE.
> >
> > I know I can use the module xml to replace classes when specific
> > browser versions are used, but is there any way to tell within the
> > code?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to