Navigate To URL
force:navigateToURL
Navigates from a custom component to the specified URL.
For Use In
Lightning Experience, Experience Builder Sites, Salesforce Mobile App
Instead of using force:navigateToURL, we recommend navigating to web pages using the lightning:navigate component with the standard__webPage page type. For more information, see the Lightning Aura Components Developer Guide.
Relative and absolute URLs are supported. Relative URLs are relative to the Salesforce mobile web domain, and retain navigation history. External URLs open in a separate browser window.
Use relative URLs to navigate to different screens within your app. Use external URLs to allow the user to access a different site or app, where they can take actions that don’t need to be preserved in your app. To return to your app, the separate window that’s opened by an external URL must be closed when the user is finished with the other app. The new window has a separate history from your app, and this history is discarded when the window is closed. This also means that the user can’t click a Back button to go back to your app; the user must close the new window.
mailto:, tel:, geo:, and other URL schemes are supported for launching external apps and attempt to "do the right thing". However, support varies by mobile platform and device. mailto: and tel: are reliable, but we recommend that you test any other URLs on a range of expected devices.
When using mailto: and tel: URL schemes, consider using lightning:formattedEmail and lightning:formattedUrl components.
This example navigates a user to the opportunity page, /006/o, using a relative URL.
This example opens an external website when the link is clicked.
This event is handled by the one.app container. It’s supported in Lightning Experience, the Salesforce mobile app, and Aura-based Experience Builder sites. However, Experience Builder sites don't support force.com URL navigation with the force:navigateToURL event.
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
isredirect | When redirecting in place, this attribute prevents the creation of multiple history entries in hybrid environments. In this case, hybrid treats redirects as a single history entry. | boolean | false | |
networkId | Inherited. Network that the event is associated with. | string | ||
url | The URL of the target. | string | ![]() |
