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

3
  • 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
    Commented Sep 16, 2020 at 9:10
  • I guess no basically I need to create this url garvitasb2bsc--4hdev.cs60.my.salesforce.com/p/attach/… once my button is clicked is there is any other work around
    – garvi
    Commented Sep 16, 2020 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
    Commented Sep 16, 2020 at 12:56

1 Answer 1

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.

1
  • It is actually refreshing the component itself I want to open in the same window attaching the screenshot in above question
    – garvi
    Commented Sep 16, 2020 at 9:59

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