Sdílet prostřednictvím


BrowserInformation.ProductName Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the product name of the browser.

Namespace:  System.Windows.Browser
Assembly:  System.Windows.Browser (in System.Windows.Browser.dll)

Syntax

'Declaration
Public ReadOnly Property ProductName As String
public string ProductName { get; }

Property Value

Type: System.String
The product name of the browser.

Remarks

The browser product name is the familiar name of the browser, such as "FireFox". This name is typically different from the Name property value, which indicates the name of the underlying browser technology, such as "Netscape".

The value of the ProductName property is extracted from the UserAgent value.

Examples

The following example demonstrates how to use the BrowserInformation class.

Imports System
Imports System.Windows.Controls
Imports System.Windows.Browser

Public Class Example
   Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)

      outputBlock.Text += vbCrLf
      outputBlock.Text += "Silverlight can provide browser information:" & vbCrLf
      outputBlock.Text += "Browser Name = " & HtmlPage.BrowserInformation.Name & vbCrLf
      outputBlock.Text += "Browser Version = " & HtmlPage.BrowserInformation.BrowserVersion.ToString() & vbCrLf
      outputBlock.Text += "UserAgent = " & HtmlPage.BrowserInformation.UserAgent & vbCrLf
      outputBlock.Text += "Platform = " & HtmlPage.BrowserInformation.Platform & vbCrLf
      outputBlock.Text += "CookiesEnabled = " & HtmlPage.BrowserInformation.CookiesEnabled.ToString() & vbCrLf
      outputBlock.Text += "ProductName = " & HtmlPage.BrowserInformation.ProductName.ToString() & vbCrLf
      outputBlock.Text += "ProductVersion = " + HtmlPage.BrowserInformation.ProductVersion.ToString()

   End Sub 'Main
End Class 'Sample
using System;
using System.Windows.Controls;
using System.Windows.Browser;

public class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
     outputBlock.Text +=
       "\nSilverlight can provide browser information:\n" +
       "\nBrowser Name = " + HtmlPage.BrowserInformation.Name +
       "\nBrowser Version = " + HtmlPage.BrowserInformation.BrowserVersion.ToString() +
       "\nUserAgent = " + HtmlPage.BrowserInformation.UserAgent +
       "\nPlatform = " + HtmlPage.BrowserInformation.Platform +
       "\nCookiesEnabled = " + HtmlPage.BrowserInformation.CookiesEnabled.ToString() +
       "\nProductName = " + HtmlPage.BrowserInformation.ProductName.ToString() +
       "\nProductVersion = " + HtmlPage.BrowserInformation.ProductVersion.ToString();
   }
}

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.