I have created an ltng:outApp app and created a lightning component inside it. This is embedded in a visualforce page as a button. So when I click on the button, the component will be created and I will clone a record in the lightning controller.After cloning I want to redirect to the newly cloned record page rather than the VF page which displayed.This part is not working.

var resultData = response.getReturnValue();// this is ID of the cloned record
            var context = component.get("v.UserContext");
            if(context != undefined) {
                if(context == 'Theme4t' || context == 'Theme4d') {
                    console.log('VF in S1 or LEX');
                } else {
                    console.log('VF in Classic');                         
            } else {
                console.log('standalone Lightning Component');

I can see the console.log('standalone Lightning Component'); But after that window.location is not working .IF I give window.open it will show me refused to connect error

  • This worked for us- window.location.href = 'your URL';
    – Raul
    Nov 27, 2018 at 10:15
  • You can use this : window.top.location.href = '/one/one.app#/sObject/'+sfdcRecordId+'/view'
    – MIX DML
    Nov 27, 2018 at 10:55
  • This question is more or less a duplicate of How to navigate in lightning out?. Using window navigation methods is not really supported in the Lightning Experience, even if it may work in certain circumstances.
    – Adrian Larson
    Nov 28, 2018 at 16:32

1 Answer 1


To navigate to the record created or in lightning page you should give the URL or you can try

if(// your condition){
        var quoteId= component.get("v.recId");// get the record ID from the lighting page(implement force:hasRecordId)
        var navEvt = $A.get("e.force:navigateToSObject");
         "recordId": quoteId

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.