views:

49

answers:

3

Hi, How can i detected the browser type in my silverlight application?

for example i want to know if my silverlight application is running on IE or Firefox Or GoogleChrome...

i'm using silverlight 4 and my programming language is c#

A: 

If you are using JQuery, then u can use the Browser plugin of Jquery.

if you are using JS but not JQuery, then can follow this example from w3schools

Sadat
+1  A: 

Use the HtmlPage.BrowserInformation property.

Code Example (given a TextBlock called "txtOut"):-

    txtOut.Text = String.Format("Name: {0}\nVersion: {1}\nProduct Name: {2}\nProduct Version: {3}\nUser Agent: {4}\nPlatform: {5}",
        HtmlPage.BrowserInformation.Name,
        HtmlPage.BrowserInformation.BrowserVersion,
        HtmlPage.BrowserInformation.ProductName,
        HtmlPage.BrowserInformation.ProductVersion,
        HtmlPage.BrowserInformation.UserAgent,
        HtmlPage.BrowserInformation.Platform);

I have IE 7 and Firefox 3.6.6 and it would seem that ProductName and possible ProductVersion would be you best choice to determine the browser.

AnthonyWJones
A: 

If you are using Jquery or java script, then you can use navigator.appName for getting name of the browser.

Venom