Hello Everyone,
I am using sforce.one.navigateToURL method in Javascript to navigate to different VF page in lightning when a button is clicked on a parent VF page.
for example : sforce.one.navigateToURL("/apex/OpportunityEditList?Accountid={!Accid}",true);
I noticed it opens new page in same TAB, is there a way to open the new page in new TAB instead without creating any lightning component? And also back button does not take me to last page.. why
Thanks in advance.
Rahul Bansal
Hi Rahul,
So I have a weird theory about what is going on.
The user is in LEX. They click on the link and are sent to the classic version of the visualforce page, but then your redirect loads and sends them to the LEX version.
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/salesforce1_dev_jsapi_sforce_one.htm#!
"Use relative URLs to navigate to different screens within your app. Use external URLs to allow the user to access a different site or app, where they can take actions that don’t need to be preserved in your app. To return to your app, the separate window that’s opened by an external URL must be closed when the user is finished with the other app. The new window has a separate history from your app, and this history is discarded when the window is closed. This also means that the user can’t click a Back button to go back to your app; the user must close the new window."
So even though you are using a relative URL, it is reading it as an external URL because the user is switching experiences, even briefly.
And because LEX thinks it's an external URL rather than a relative URL, the history is discarded, so you can't use the back button from that new window/tab.
Not sure exactly how to fix it, but maybe this can help you figure out what is going on at least?
Best,
Katharine