How To make Router.navigate as deeplink url

Hi All, I have one requirement we are using router.naviaget for navigating to different screens but we need to make it as a deeplink url can anyone please help me with this?

Hi Shruthi, could you go into more detail on what exactly you need to do?

Hi @shruthi.s1
I am not aware of how your app is designed, but here are a few things you can do.

  1. check if at any point you refresh the page of your app, how the app behaves. does it retain everything’s what was there on the page earlier or not?
  2. check if you have implemented boot page or not. LightningJS.io - Documentation
  3. for deeplinking, there are few methods using which you can extract the information from url.
  • Router.getQueryStringParams()
  • set params(v) Use this method in the boot page or your 1st screen like splash
  • window.location.href

Okay @frank Thank you so much

window.location.replace('http://example.com');

It’s better than using window.location.href = ‘http://example.com’;

Using replace() is better because it does not keep the originating page in the session history, meaning the user won’t get stuck in a never-ending back-button fiasco.

If you want to simulate someone clicking on a link, use window.location.href

If you want to simulate an HTTP redirect, use window.location.replace

You can use assign() and replace methods also to javascript redirect to other pages like the following:

location.assign("http://example.com");

The difference between replace() method and assign() method(), is that replace() removes the URL of the current document from the document history, means it is not possible to use the “back” button to navigate back to the original document. So Use the assign() method if you want to load a new document, andwant to give the option to navigate back to the original document.