Поиск в Поддержке

Избегайте мошенников, выдающих себя за службу поддержки. Мы никогда не попросим вас позвонить, отправить текстовое сообщение или поделиться личной информацией. Сообщайте о подозрительной активности, используя функцию «Пожаловаться».

Подробнее

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

  • Нет ответов
  • 0 имеют эту проблему
  • 26 просмотров
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.

Для ответа на сообщения вы должны войти в свою учётную запись. Пожалуйста, задайте новый вопрос, если у вас ещё нет учётной записи.