Salesforce.com offically discourages Lightning developers to use href="/id" links in Lightning components and recommends complicated solutions as described here Locker-Service safe passing of data from <a> and <lightning:xyz> to controller.

I also found no official document explaining how and when to use the internal Lightning pseudo URLs (e.g. #/sObject//view).

Besides its complexity a solution using onlick and a JS event handler has another drawback. It disables the users option to Keyboard-click (CMD, Strg, Alt) a link to open it in a new tab.

So my question is: Why is using not allowed? And where? Are there places where I can safely use it?


2 Answers 2


In LEX, salesforce uses <a> tags with an href attribute to navigate to records.

Although rather than using href="/<id>", it is href="#/sObject/<id>/view"

enter image description here

I personally can't say for sure whether or not the way the LEX app handles url fragments will be subject to change, or whether developers can safely use this pattern directly for controlling navigation.

Of course, if your components are going to be used in your own lightning application, you would have full control of URL-Centric Navigation and could use <a> tags freely.

Update: Summer '18

There is now a New URL Format for Lightning Experience and the Salesforce Mobile App

  • Not really an answer why Salesforce discourages developer to use URL hackings like this. I know I can use this but I need to know how safe and stable it is. Commented Jun 6, 2017 at 13:27

Now with Summer'18 the beautiful pattern of


seems to be broken by Salesforce. So as an answer: it seems you can't use it anymore. However using js-handler for simple things such as an links feels ridiculous.

I think we need a new question searching for alternatives.


You must log in to answer this question.

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