Name

ClientTarget

Synopsis

String = Page.ClientTarget

Gets or sets a string value that allows you to override automatic browser detection in ASP.NET, force the page to be rendered for a browser type configured in machine.config or web.config, and specified by this property. The available preconfigured values for this property are:

downlevel

The page will be rendered based on the browser capabilities defined for unknown browsers in the <browserCaps> element of machine.config.

ie4

The page will be rendered based on the values for Internet Explorer 4.0 configured in the <browserCaps> element of machine.config.

ie5

The page will be rendered based on the values for Internet Explorer 5.0 configured in the <browserCaps> element of machine.config.

Parameters

String

A string that specifies the alias for the browser capabilities that the page will target.

Example

The following code example initializes the ClientTarget property of the Page class to downlevel, indicating that ASP.NET must render the page for an unknown browser type, which will result in HTML 3.2-compliant output. The example then displays a message indicating whether a set of features is supported. In the case of downlevel, none of the listed features is supported.

Sub Page_Load( ) Page.ClientTarget = "downlevel" Message.Text = "Page is set to render for the " & _ Page.ClientTarget & " alias.<br/>" Message.Text &= "Supported features:<br/>" Message.Text &= " - JavaScript: " & _ Request.Browser.JavaScript & "<br/>" Message.Text ...

Get ASP.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.