You can use NavigateUrl in a ViewModel action to send the user's browser to a URL, optionally choosing whether the URL opens in a new tab.
Syntax
selfVM.NavigateUrl(theurl)
selfVM.NavigateUrl(theurl, openinnewtab)
| Part | Description |
|---|---|
selfVM
|
The current ViewModel in which the action runs. |
theurl
|
The URL that the browser should navigate to, supplied as a string. |
openinnewtab
|
A Boolean value that controls whether the URL opens in a new tab: true opens a new tab and false uses the current tab.
|
Open a URL in a new tab
Call NavigateUrl with the URL only to open the URL in a new tab.
selfVM.NavigateUrl('https://www.google.com')
Choose the target tab explicitly
Use the second argument when the action must state the intended browser behavior.
Open in a new tab
selfVM.NavigateUrl('https://www.google.com', true)
Use the current tab
The following action navigates the current browser tab to the URL.
selfVM.NavigateUrl('https://www.google.com', false)
Use in an action
Add the expression to the action that should initiate the navigation. For example, an action can send the user to an external help page without replacing the page they are currently working on:
selfVM.NavigateUrl('https://www.google.com', true)
Use false when the destination should replace the current page, such as when the user is leaving the current workflow.
URL format
Provide a complete URL string, including the protocol. For example, use https://www.google.com. Do not use backslashes in the URL path.
