force:navigateToURL

Navigates to the specified URL.

Relative and absolute URLs are supported. Relative URLs are relative to the Salesforce1 mobile browser app 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.
Note

Note

Only standard URL schemes are supported by navigateToURL. To access custom schemes, use window.location instead.

When using mailto: and tel: URL schemes, you can also consider using ui:outputEmail and ui:outputURL components.

This example navigates a user to the opportunity page, /006/o, using a relative URL.

gotoURL : function (component, event, helper) {
    var urlEvent = $A.get("e.force:navigateToURL");
    urlEvent.setParams({
      "url": "/006/o"
    });
    urlEvent.fire();
}
This example opens an external website when the link is clicked.
navigate : function(component, event, helper) {

    //Find the text value of the component with aura:id set to "address"
    var address = component.find("address").get("v.value");

    var urlEvent = $A.get("e.force:navigateToURL");
    urlEvent.setParams({
      "url": 'https://www.google.com/maps/place/' + address
    });
    urlEvent.fire();
}
Note

Note

This event is handled by the one.app container. It’s supported in Lightning Experience, Salesforce1, and Lightning communities.

Attribute Name Type Description Required?
isredirect Boolean Indicates that the new URL should replace the current one in the navigation history. Defaults to false.
url String The URL of the target. Yes