Przeszukaj pomoc

Unikaj oszustw związanych z pomocą.Nigdy nie będziemy prosić Cię o dzwonienie na numer telefonu, wysyłanie SMS-ów ani o udostępnianie danych osobowych. Zgłoś podejrzaną aktywność, korzystając z opcji „Zgłoś nadużycie”.

Learn More

Browser Back Button

  • Nie ma odpowiedzi
  • 1 osoba ma ten problem
  • 16 wyświetleń
  • Ostatnia odpowiedź od JP

more options

In our banking web site we need to show a pop up while the end user clicks the back button. I have implemented the solution in javascript and the solution works in other browser, but in firefox when we need to click the browser back button twice or thrice to show the pop up. Need help to solve this issue.

In our banking web site we need to show a pop up while the end user clicks the back button. I have implemented the solution in javascript and the solution works in other browser, but in firefox when we need to click the browser back button twice or thrice to show the pop up. Need help to solve this issue.

Wszystkie odpowiedzi (1)

more options

You could try this solution from stack overflow (ddg.gg/javascript confirmation back button). The dialog opens when I press the back button once. Put this in a file and call `firefox index.html`.

<meta charset="UTF-8"> <title>JavaScript Hello World Example</title> <script> if (window.history && history.pushState) { addEventListener('load', function() { history.pushState(null, null, null); // creates new history ent> addEventListener('popstate', function() { var stayOnPage = confirm("Would you like to save this draft> if (!stayOnPage) { history.back() } else { history.pushState(null, null, null); } }); }); } </script>