Redirect to a record or any other page not working for an aura component which is embedded in a VF page. tried force:navigateToURL, but does not work as I get an error that says "object not defined" for e.force:navigateToURL. tried the static URL redirect, this works, but the page opens in the iFrame where the VF page sits on the detail page of the record.

I was hoping to find a way to redirect to a record or any other page from the detail page on which the VF page is embedded to a new page on the browser.

Any ideas/suggestions?

I need it to work for the VF page embedded which is calling an aura component.

2 Answers 2


One way that will work is to add a "callback" attribute to the component definition. In that callback you can trigger a redirect.

Add this to your component:

<aura:attribute name="callback" type="String" description="Call this to communcate results to parent" access="global"/>

In your helper class you would call it like this:

var func = cmp.get('v.callback');
if (func){
  func(); //this has no params, but you can pass them if you like

Finally in your instantiation, define the callback:

$Lightning.use("c:AppContainer", function () {
      $Lightning.createComponent("c:App", {
        callback: function(){window.location = "http://www.somewhere.com";},
        otherattribute: "blah"
      }, elementId, function (cmp) {});

Oh and don't worry that the attribute definition is a string - the magic of Javascript takes care of that for you ;)

  • Thanks Casper. I wanted to automate navigation from helper class without having user click a link. This worked like a charm. May 11, 2017 at 21:16

I found the solution while trying your solution.

Not sure if your solution works, didn't really work when I tried.

However, there is a really easy solution, use the 'target' attribute in the ui:outputURL and use the value '_parent'

this works perfectly fine.

You must log in to answer this question.

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