I would like to know if there is any way that in my application when pressing the back button of a browser instead of being sent to the previous page, I was sent to a route that I have established.
//suponiendo que hay alguna forma de poner una ruta al botón de retroceder del navegador.
btnRetroceder(){
this.router.navigate(['/dashboard']);
}
Do something "similar" to that, I'm curious if there is a way to do something like that. Or as another option you can't go back, or disable the browser's back button. Thanks in advance.
I have tested this solution in Angular 8+
Based on this question https://stackoverflow.com/questions/12381563/how-can-i-stop-the-browser-back-button-using-javascript I was able to solve it like this: