This is a mirror of official site: http://jasper-net.blogspot.com/

Browser Information In Silverlight

| Thursday, November 18, 2010
In this post I will show you how to get the browser information.To get the browser information the namespace used for this is System.Windows.Browser. The BrowserInformation object contains properties such as the name, product name, product version , browser version etc. Let us start with the example which will use to get this information and display on the screen which I will share with you at the end of the post I will use two screen shot one for the Internet explorer and the second one for the Fire Fox.
For this Example I have create one class with the name BrowserInfo  which has the properties like BrowserName , BrowerVersion, Platform, ProductName, UserAgent of type string , IsCookiesEnabled of type Boolean to indicate whether Cookies are enabled or not , BrowserMinorVersion and BrowserMajorVersion are of type int.You can see the default constructor of the BrowserInfo class which is used to initialize all the properties of the class.

public BrowserInfo()
       {
           BrowserName = HtmlPage.BrowserInformation.Name;
           BrowserVersion = HtmlPage.BrowserInformation.BrowserVersion.ToString();
           BrowserMajorVersion = HtmlPage.BrowserInformation.BrowserVersion.Major;
           BrowserMinorVersion = HtmlPage.BrowserInformation.BrowserVersion.Minor;
           IsCookiesEnabled = HtmlPage.BrowserInformation.CookiesEnabled;
           Platform = HtmlPage.BrowserInformation.Platform;
           ProductName = HtmlPage.BrowserInformation.ProductName;
           ProductVersion = HtmlPage.BrowserInformation.ProductVersion;
           UserAgent = HtmlPage.BrowserInformation.UserAgent;            
       }

Read more: Asim Sajjad

Posted via email from .NET Info

0 comments: