Changeset 4853

Show
Ignore:
Timestamp:
06/11/08 08:30:29 (5 months ago)
Author:
matti.tahvonen@…
Message:

Enhanced browser detection system.

Location:
trunk/src/com/itmill/toolkit/terminal/gwt/client
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/com/itmill/toolkit/terminal/gwt/client/Util.java

    r4751 r4853  
    2424        if(window.console) 
    2525            debugger; 
    26     }-*/; 
    27  
    28     /** 
    29      * Detects if current browser is IE. 
    30      *  
    31      * @return true if IE 
    32      */ 
    33     public static native boolean isIE() 
    34     /*-{ 
    35        var browser=$wnd.navigator.appName; 
    36        if (browser=="Microsoft Internet Explorer") { 
    37            return true; 
    38        } 
    39        return false; 
    40     }-*/; 
    41  
    42     /** 
    43      * Detects if current browser is IE6. 
    44      *  
    45      * @return true if IE6 
    46      */ 
    47     public static native boolean isIE6() 
    48     /*-{ 
    49     var browser=$wnd.navigator.appName; 
    50     if (browser=="Microsoft Internet Explorer") { 
    51         var ua = navigator.userAgent; 
    52                 var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); 
    53                 if (re.exec(ua) != null) 
    54                         rv = parseFloat(RegExp.$1); 
    55                         if(rv == 6) return true; 
    56     } 
    57     return false; 
    5826    }-*/; 
    5927 
     
    10775    } 
    10876 
    109     public static boolean isIE7() { 
    110         return isIE() && !isIE6(); 
     77    /** 
     78     * Detects if current browser is IE. 
     79     *  
     80     * @deprecated use BrowserInfo class instead 
     81     *  
     82     * @return true if IE 
     83     */ 
     84    public static boolean isIE() { 
     85        return BrowserInfo.get().isIE(); 
    11186    } 
    11287 
    113     public static native boolean isFF2() 
    114     /*-{ 
    115     var browser=$wnd.navigator.appName; 
    116     if (browser=="Netscape") { 
    117         var ua = navigator.userAgent; 
    118         var re  = new RegExp("Firefox/([0-9]+)"); 
    119         if (re.exec(ua) != null) 
    120             var rv = parseInt(RegExp.$1); 
    121             if(rv && rv == 2)  
    122                 return true; 
     88    /** 
     89     * Detects if current browser is IE6. 
     90     *  
     91     * @deprecated use BrowserInfo class instead 
     92     *  
     93     * @return true if IE6 
     94     */ 
     95    public static boolean isIE6() { 
     96        return BrowserInfo.get().isIE6(); 
    12397    } 
    124     return false; 
    125     }-*/; 
     98 
     99    /** 
     100     * @deprecated use BrowserInfo class instead 
     101     * @return 
     102     */ 
     103    public static boolean isIE7() { 
     104        return BrowserInfo.get().isIE7(); 
     105    } 
     106 
     107    /** 
     108     * @deprecated use BrowserInfo class instead 
     109     * @return 
     110     */ 
     111    public static boolean isFF2() { 
     112        return BrowserInfo.get().isFF2(); 
     113    } 
    126114 
    127115    private static final Element escapeHtmlHelper = DOM.createDiv();