2022
Utilize your app routing - more of an "angular approach" rather than accessaccessing the browser's location object for navigation history.
Think of why you need the user to go 'back', and what 'back' means in the broader context of your application and its routes.
for example, returning to a parent route from its child
this.router.navigate(['..'], {relativeTo: this.route});
You can also read about previous navigation
previousNavigation : The previously successful Navigation object. Only one previous navigation is available, therefore this previous Navigation object has a null value for its own previousNavigation.