Changeset 1161

Show
Ignore:
Timestamp:
2007-12-01 16:40:50 (8 months ago)
Author:
fredck
Message:

Fixed #1548 : Added Safari and Opera detection to FCKeditor.Net.
For #79 : Introduced the FCKeditor.IsCompatibleBrowser static function, to check if the requesting browser is compatible with FCKeditor.

Location:
FCKeditor.Net/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor.Net/trunk/FCKeditor.cs

    r182 r1161  
    373373                } 
    374374 
     375                #endregion 
     376 
     377                #region Compatibility Check 
     378 
    375379                public bool CheckBrowserCompatibility() 
    376380                { 
    377                         System.Web.HttpBrowserCapabilities oBrowser = Page.Request.Browser ; 
     381                        return IsCompatibleBrowser( Page.Request ); 
     382                } 
     383 
     384                /// <summary> 
     385                /// Checks if the current HTTP request comes from a browser compatible 
     386                /// with FCKeditor. 
     387                /// </summary> 
     388                /// <returns>"true" if the browser is compatible.</returns> 
     389                public static bool IsCompatibleBrowser() 
     390                { 
     391                        return IsCompatibleBrowser( System.Web.HttpContext.Current.Request ); 
     392                } 
     393 
     394                /// <summary> 
     395                /// Checks if the provided HttpRequest object comes from a browser 
     396                /// compatible with FCKeditor. 
     397                /// </summary> 
     398                /// <returns>"true" if the browser is compatible.</returns> 
     399                public static bool IsCompatibleBrowser( System.Web.HttpRequest request ) 
     400                { 
     401                        System.Web.HttpBrowserCapabilities oBrowser = request.Browser; 
    378402 
    379403                        // Internet Explorer 5.5+ for Windows 
    380                         if (oBrowser.Browser == "IE" && ( oBrowser.MajorVersion >= 6 || ( oBrowser.MajorVersion == 5 && oBrowser.MinorVersion >= 0.5 ) ) && oBrowser.Win32) 
    381                                 return true ; 
    382                         else 
    383                         { 
    384                                 Match oMatch = Regex.Match( this.Page.Request.UserAgent, @"(?<=Gecko/)\d{8}" ) ; 
    385                                 return ( oMatch.Success && int.Parse( oMatch.Value, CultureInfo.InvariantCulture ) >= 20030210 ) ; 
    386                         } 
     404                        if ( oBrowser.Browser == "IE" && ( oBrowser.MajorVersion >= 6 || ( oBrowser.MajorVersion == 5 && oBrowser.MinorVersion >= 0.5 ) ) && oBrowser.Win32 ) 
     405                                return true; 
     406 
     407                        string sUserAgent = request.UserAgent; 
     408 
     409                        if ( sUserAgent.Contains( "Gecko/" ) ) 
     410                        { 
     411                                Match oMatch = Regex.Match( request.UserAgent, @"(?<=Gecko/)\d{8}" ); 
     412                                return ( oMatch.Success && int.Parse( oMatch.Value, CultureInfo.InvariantCulture ) >= 20030210 ); 
     413                        } 
     414 
     415                        if ( sUserAgent.Contains( "Opera/" ) ) 
     416                        { 
     417                                Match oMatch = Regex.Match( request.UserAgent, @"(?<=Opera/)[\d\.]+" ); 
     418                                return ( oMatch.Success && float.Parse( oMatch.Value, CultureInfo.InvariantCulture ) >= 9.5 ); 
     419                        } 
     420 
     421                        if ( sUserAgent.Contains( "AppleWebKit/" ) ) 
     422                        { 
     423                                Match oMatch = Regex.Match( request.UserAgent, @"(?<=AppleWebKit/)\d+" ); 
     424                                return ( oMatch.Success && int.Parse( oMatch.Value, CultureInfo.InvariantCulture ) >= 522 ); 
     425                        } 
     426 
     427                        return false; 
    387428                } 
    388429 
  • FCKeditor.Net/trunk/_whatsnew.html

    r1160 r1161  
    3838                New Features and Improvements:</p> 
    3939        <ul> 
    40                 <li>Added specific project files for Visual Studio .NET 2003 and Visual Studio 
    41                         2005. It's easier now to open the source in your preferred environment. Builds will 
    42                         end up in the "1.1" (VS2003) and "2.0" (VS2005) folders inside bin/Debug and bin/Release.</li> 
     40                <li>Compatible with <strong>Safari 3.0+</strong> and <strong>Opera 9.50+</strong>.</li> 
     41                <li>Introduced the <strong>FCKeditor.IsCompatibleBrowser</strong> static function, to 
     42                        check if the requesting browser is compatible with FCKeditor.</li> 
     43                <li>Added specific project files for <strong>Visual Studio .NET 2003</strong> and <strong> 
     44                        Visual Studio 2005</strong>. It's easier now to open the source in your preferred environment. Builds will 
     45                        end up in the "1.1" (VS2003) and "2.0" (VS2005) folders inside bin/Debug and bin/Release. </li> 
    4346        </ul> 
    4447        <p>