SharePoint and HTML 5 Technical Implementation
Browser Check
// Browser check class. Should be greatly improved to check for features and versions instead of browser type
public static bool IsHTML5CompliantBrowser()
        {
            bool aReturnBool = true;
            System.Web.HttpBrowserCapabilities browser = HttpContext.Current.Request.Browser;
            // best way is to check the following string for 'chrome','safari', etc?
            string useragent = HttpContext.Current.Request.UserAgent;
            // Internet Explorer = "IE"
            // Firefox = "Firefox"
            // Chrome = "AppleMAC-Safari"
            switch (browser.Browser)
            {
                case "AppleMAC-Safari": 
                    { 
                        aReturnBool = true; 
                    } break;
                case "IE": 
                    { 
                        aReturnBool = false; 
                    }
                    break;
                case "Firefox":
                    {
                        aReturnBool = true;
                    } break;
                default:
                    {
                        aReturnBool = false;
                    } break; 
            }
            return aReturnBool;
        }
 
No comments:
Post a Comment