How to add a parameter in URL in LWC

Requirement :-

Today, I got the requirement when user click the button some parameters get add in URL.

Tried :-

  • …/lightning/yourURL?id=123
  • ../lightning/yourURL/123

But, both URL get auto-stripped. After 30 min of struggle, I got to know how to do this.


Whenever you want to add a parameter, you have to use the namespace. If there is no namespace in your org. Then, use “c__”

  • …/lightning/yourURL?c__id=123

For the official article click here

Hope you like this article. If you feel, this is useful for you. So, comment below and subscribe to the blog by filling the right form.