3

Can anyone tell me how is the lightning component url in the browser generated ? It is composed from what ?

e.g this url : /one/one.app#eyJjb21wb25lbnREZWYiOiJjOkxDMjhfR2VzdGlvbkNvbXB0ZSIsImF0dHJpYnV0ZXMiOnt9LCJ0IjoxNDc5MzY5MTMyOTQ0fQ%3D%3D

I Have notice that the cwODk4OTEy part of the url different for another user. I need to compose this url toward my component for a simple reason that a visualforce page cannot redirect to a component, but i can rewrite my browser url so that it takes me to my component. This work, butI need a way to generate or to calculate this value to the component. Does anyone know how to do that ?

6

The portion of the URL after the # character is a URL encoded, base64 encoded JSON object. If you decode this you end up with the following:

  {
    "componentDef" : "c:LC28_GestionCompte",
    "attributes" : {},
    "t" : 1479369132944
  }

This is very similar to parameters for the force:navigateToComponent event that was added in Winter '17 (https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_force_navigateToComponent.htm)

The t attribute on the object appears to be a timestamp.

The internals of this URL are subject to change, so you should really be using one of the supported Lightning events to perform navigation rather than URL hacking.

1
  • 1
    This is the answer i needed :) In fact if i remove the timestamp it still works. – vanessen Nov 17 '16 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.