| 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; |
| 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; |