How to detect browser back button click event using polymer?
Asked Answered
W

1

6

Is it possible to detect that a user entered a page through using the history back button in his browser? Preferably I want to detect this action using polymer.

Wriggle answered 23/12, 2016 at 6:12 Comment(5)
No,it's not possible (easily).Led
possible duplicate of #1844991Celestinacelestine
Do you use Polymer's router?Counterweight
yes.. i use <app-route>Wriggle
Have you tried the history API?Counterweight
D
1

You could probably listen on the popstate event as documented here: https://developer.mozilla.org/en-US/docs/Web/Events/popstate

This should fire when the back button is clicked, history.back() is called, etc.

Dorweiler answered 23/3, 2018 at 15:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.