Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
¿Cómo desencadenar una tarea específica cuando se hace clic en el botón Atrás en el navegador CADA VEZ?

Estoy tratando de activar una tarea específica, como cambiar el CSS del elemento cada vez que el usuario hace clic en el botón Atrás del navegador.

Afortunadamente, SO me respaldó con el siguiente código, que se activa cuando un usuario hace clic en el botón Atrás y realiza la tarea.

Sin embargo, este activador en el clic del botón Atrás solo funciona una vez por carga de página. Por lo tanto, la función().

¿Alguien puede ayudarme con cómo hacer que se active cada vez que se presiona el botón Atrás?

El código va como:

 $(function() { if (window.history && window.history.pushState) { window.history.pushState('', null, './'); $(window).on('popstate', function() { // My stuff }); } });

Cualquier ayuda es muy apreciada .

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use event listener, no sé cómo hacerlo en jQuery, el código se verá así

 if (window.history && window.history.pushState) { window.history.pushState('', null, './'); window.addEventListener('popstate', function() { // My stuff }); } });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!