I want to inject a new state to browser history when the platform is loaded for the 1st time so when the user clicks browser back button it should land to the home page of the app.
I tried to add new state using 1. PlatformLocation pushState() 2. window.history.pushState()
location.pushState(null, 'home', 'home');
// window.history.pushState(null, 'home', 'home');
I even tried giving full URL
location.pushState(null, 'home', 'http://localhost:4200/home');
// window.history.pushState(null, 'home', 'http://localhost:4200/home');
It does add a new state to browser history but when I click browser back button, nothing happens i.e. I am still in the same page but only the newly added state is removed from the browser history.