I'm implementing a redirect in a Lightning component, but it's opening in a new browser tab. I want the redirect to happen in the same tab:

navigate : function(component, event, helper) {
 var urlEvent = $A.get("e.force:navigateToURL");
    'url': 'http://www.myurl.com'

Is there a way to force it to redirect in the same browser tab?

  • 1
    No it does not work.....you may need to use window.location...
    – Ayub
    Sep 5, 2018 at 15:36

1 Answer 1


While using e.force:navigateToURL event, to be able to remain in the same window/tab, you need to use relative URL. If you use an absolute or external URL (as in your case), by default the event opens up a new window/tab and that there's no way to control that behavior.

Below is the excerpt where this behavior is mentioned in the event's documentation:

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.

If you refer to the example in the documentation, the first approach navigates to an Opportunity tab within the same window, whereas the second example opens the link in a new tab/window.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .