0

I want to understand if there is any way to fetch the current lightning component url in salesforce and navigate to it

I am using

window.location.href = window.location.pathname;

in my lightning component for redirection, but it is taking me to classic instead of the lightning view

1 Answer 1

2

You can use implements="lightning:isUrlAddressable" to get the URL and its parameter.

And use pageReference for navigation. Is Url Addressable

var navService = component.find("navService");
var pageReference = component.get("v.pageReference");
event.preventDefault();
navService.navigate(pageReference);

You must log in to answer this question.

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