2009/05/29

Get browser capabilities

I learn from Ramp Up. This is useful if you want to know client support javascript or not.
HttpBrowserCapabilities browser = Request.Browser;
Label1.Text = "Browser Capabilities\n"
  + "Type = " + browser.Type + "\n"
  + "Name = " + browser.Browser + "\n"
  + "Version = " + browser.Version + "\n"
  + "Major Version = " + browser.MajorVersion + "\n"
  + "Minor Version = " + browser.MinorVersion + "\n"
  + "Platform = " + browser.Platform + "\n"
  + "Is Beta = " + browser.Beta + "\n"
  + "Is Crawler = " + browser.Crawler + "\n"
  + "Is AOL = " + browser.AOL + "\n"
  + "Is Win16 = " + browser.Win16 + "\n"
  + "Is Win32 = " + browser.Win32 + "\n"
  + "Supports Frames = " + browser.Frames + "\n"
  + "Supports Tables = " + browser.Tables + "\n"
  + "Supports Cookies = " + browser.Cookies + "\n"
  + "Supports VBScript = " + browser.VBScript + "\n"
  + "Supports JavaScript = " + browser.EcmaScriptVersion.ToString() + "\n"
  + "Supports Java Applets = " + browser.JavaApplets + "\n"
  + "Supports ActiveX Controls = " + browser.ActiveXControls + "\n";
Please replace the "\n" with "<br />".

No comments:

Post a Comment