In a Salesforce Community's knowledge article detail page, I am using window.location.pathname in lightning component controller to retrieve the page url (I want to later pass the url to the Apex controller to get the article url name). This is working in Salesforce classic but not in Lightning Experience. Is there any alternative?

I have read about pageReference and sforce.one navigation methods but I don't want to navigate, just to extract the url of the current community page.

1 Answer 1


You can try the lightning:isUrlAddressable interface on your custom lightning component.

More info here: lightning:isUrlAddressable

You must log in to answer this question.

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