You need to sign in to do that
Don't have an account?
Emily Johnson 23
navigateToURL using window.open causes original page URL to change
I'm using e.force:navigateToURL for clickable links in my lightning component. I have tried several different ways of creating this url. I need it to open the links in a new tab so that the original window remains open.
When the links are clicked, it opens the URL in a new window (as expected), but it's also changing the original window's URL. How do I prevent this from happening?
Here is my function:
Lightning component with clickable link:
New tab that is opened:
Original tab (after clicking link):
When the links are clicked, it opens the URL in a new window (as expected), but it's also changing the original window's URL. How do I prevent this from happening?
Here is my function:
handleClick : function(component, event, helper) { var baseURL = component.get("v.cbaseURL"); var viewRecordEvent = $A.get("e.force:navigateToURL"); viewRecordEvent.setParams({ "url": window.open(baseURL+'/'+ event.target.id,'_blank') }); viewRecordEvent.fire(); }Here are some screenshots showing the behavior.
Lightning component with clickable link:
New tab that is opened:
Original tab (after clicking link):
For this particular item, I ended up changing the click handler to this:
Hope it helps.