共用方式為


HtmlWindow.Navigate Method (Uri, String)

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

Opens the specified page in the specified browser instance.

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

Syntax

'Declaration
Public Function Navigate ( _
    navigateToUri As Uri, _
    target As String _
) As HtmlWindow
public HtmlWindow Navigate(
    Uri navigateToUri,
    string target
)

Parameters

  • navigateToUri
    Type: System.Uri
    The URL of the page to open.
  • target
    Type: System.String
    The name of the window or tab that navigateToUri should be opened in.

Return Value

Type: System.Windows.Browser.HtmlWindow
A reference to the underlying window object that represents a new browser instance.

Exceptions

Exception Condition
ArgumentNullException

navigateToUri or target is nulla null reference (Nothing in Visual Basic).

Remarks

This method overload gives you the ability to open a new page in an existing browser instance other than the current browser. It is equivalent to the JavaScript open method with the target property set to the name of an existing browser.

The target parameter specifies the name of the browser instance that the navigateToUri address should be opened in:

  • If target specifies an existing browser, the URL is loaded into that browser.

  • If the target parameter is an empty string, the method functions like the Navigate(Uri) method overload, and the URL is loaded into the current browser.

NoteNote:

Your system and browser configuration settings control whether browser instances are displayed as windows, tabs, or multiple-document interface (MDI) child windows.

For more information, see the open method in the dynamic HTML (DHTML) documentation.

Examples

The following code example demonstrates how to use this method.

System.Windows.Browser.HtmlPage.Window.Navigate( _
    New Uri("https://silverlight.net"), "_blank")
System.Windows.Browser.HtmlPage.Window.Navigate(
    new Uri("https://silverlight.net"), "_blank");

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

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