0

How need to trigger event when visitor press browser back button. But, This trigger need to work only when the visitor press browser back button and this is the page that he originally landed.

Let say i have a website with Home page, About page and Contact page.

Visitor Enter to my website and the first page he visit is the Home page. after that he slide to About page, and then to Contact page. He press back button - And now he is in About page. he press back button again and now he in Home page. He press back button again .... And now it's need to indicate me the event. because he going back to where he was at the beginning before he visit my website.

I though to use counter with cookies. But i got lost.

Please help!

Thank :)

Dani Banai
  • 1,080
  • 4
  • 14
  • 33

1 Answers1

0

Maybe you could store the landingpage somewhere (session/cookie/localStorage) and use check current location in the body.beforeUnload event.

https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload

NxWebster
  • 179
  • 8