0

I want to open the URL in the same window I'm actually using the lightning component inside vf page so I can't use "Navigate To Url" as it only works in one.app container. It’s supported in Lightning Experience and Salesforce1 only. that's the reason I'm using Window.open is there is a way I can open the URL in the same window the way we can do this using "Navigate to URL".

handleOpenNewWindowWithRecordId : function(component, event, helper){
    console.log('called');
   window.open("/006/o");
}

and if i use window.open("/006/o","_self"); if just refresh the component and open the url there only enter image description here

garvita asthana
  • 53
  • 1
  • 2
  • 13
  • 1
    You would need to pass the listener function as an attribute from VF to aura component or VF page can listen an event send by aura component, an example here- How to navigate in lightning out? – Raul Sep 16 '20 at 09:10
  • I guess no basically I need to create this url https://garvitasb2bsc--4hdev.cs60.my.salesforce.com/p/attach/NoteAttach?pid=5003C000003bdmt&parentname=0114054744&retURL=%2F5003C000003bdmtQAA once my button is clicked is there is any other work around – garvita asthana Sep 16 '20 at 10:39
  • 1
    hmm, should have mentioned in the question originally that this page is embedded in standard layout. Maybe try: window.open("/006/o","_parent");, I would still handle the actual navigation in Visualforce page after listening to navigation event from the component.. – Raul Sep 16 '20 at 12:56

1 Answers1

0

Change your code to:

handleOpenNewWindowWithRecordId : function(component, event, helper){
    console.log('called');
   window.open("/006/o","_self");
}

Appending _self should force the page to open in the current tab/window.