0

I have a weird problem with a browser "back" button in Firefox and Safari. The thing is, that if I enter a website home page, then click on any link in navigation, and then press the "back" button, it throws me not on a home page, where I previously was, but on a browser's start page. It works normally, if I navigate for example from "shop" to "about us" section and then press back,

but when scenario is like: shop -> home -> about us -> back, it throws me on a "shop", not on "home"

in Chrome, Opera, IE11, Edge it works as it should, only Safari and Firefox have such problem. I am using Angular JS, the back-end is built on WordPress.

Any suggestions ?

1 Answers1

0

Its with SPA I guess.Also, you cannot touch the back button, since it is not on DOM . However, you can check for the web browser and you can create your own button function and provide functionality like : How to detect Safari, Chrome, IE, Firefox and Opera browser? and then use :

 function goBack() {
   window.history.back();
 }
Ankush Verma
  • 689
  • 1
  • 8
  • 17
  • The problem is not in creating custom button, it wouldn't be a problem, I can't understand, why browser's history doesn't save home page in it's state. – David Sergeev Mar 20 '20 at 16:29
  • Here is a website so you can reproduce it by yourself https://www.josua-dienst.org/ – David Sergeev Mar 20 '20 at 16:29
  • Okay, I understand your issue. Not entirely sure what is happening, since if you do `window.history.back()` it works just fine but otherwise, it doesn't.Kindly post the code.@ДавидСергеев – Ankush Verma Mar 20 '20 at 17:09