Hilfe durchsuchen

Vorsicht vor Support-Betrug: Wir fordern Sie niemals auf, eine Telefonnummer anzurufen, eine SMS an eine Telefonnummer zu senden oder persönliche Daten preiszugeben. Bitte melden Sie verdächtige Aktivitäten über die Funktion „Missbrauch melden“.

Weitere Informationen

Browser back button not working without user interact in the web page

  • Keine Antworten
  • 0 haben dieses Problem
  • 19 Aufrufe
more options

Hi,

I need help resolving an issue related to browser navigation and the popstate event.

Here's the scenario:

  • The user starts on page-1.html.
  • They click a button, which navigates to page-2.html.
  • When the user presses the browser back button (without clicking any button on the page), I want to trigger a JavaScript popstate event automatically.

Currently, I'm doing the following:

  • When the user arrives at page-2.html from page-1.html, I show a popup.
  • When the user closes the popup, I manually push a state using history.pushState() to create a backward URL entry.

However, my client’s requirement is to trigger the popstate event without requiring any user interaction on page-2.html, i.e., as soon as the user presses the back button.

Is there a way to programmatically achieve this behavior (ensuring the popstate event is fired) without requiring the user to click anything on page-2.html?

Any guidance or recommended approach would be greatly appreciated.

Thank you.

Hi, I need help resolving an issue related to browser navigation and the popstate event. '''Here's the scenario:''' * The user starts on page-1.html. * They click a button, which navigates to page-2.html. * When the user presses the browser back button (without clicking any button on the page), I want to trigger a JavaScript popstate event automatically. '''Currently, I'm doing the following:''' * When the user arrives at page-2.html from page-1.html, I show a popup. * When the user closes the popup, I manually push a state using history.pushState() to create a backward URL entry. However, my client’s requirement is to trigger the popstate event '''without requiring any user interaction''' on page-2.html, i.e., as soon as the user presses the back button. Is there a way to programmatically achieve this behavior (ensuring the popstate event is fired) without requiring the user to click anything on page-2.html? Any guidance or recommended approach would be greatly appreciated. Thank you.

Sie müssen sich mit Ihrem Benutzerkonto anmelden, um auf Beiträge zu antworten. Bitte stellen Sie eine neue Frage, wenn Sie noch kein Benutzerkonto haben.