0

necesito mostrar un mensaje al presionar el botón atrás del navegador, buscando por internet encontré una función para deshabilitar el botón atrás del navegados y quisiera añadir un mensaje al presionar dicho botón, sera posible?

function deshabilitaRetroceso(){
window.location.hash="no-back-button";
window.location.hash="Again-No-back-button" //chrome
window.onhashchange=function(){window.location.hash="no-back-button";}

}

1

1 respuesta 1

1

Para realizar el mensaje debes realizar una función con el mensaje que tu quieras al interior de un alert:

function mensaje{
window.location.hash=alert("Acción realizada");}

en caso de necesitar mas información: https://www.w3schools.com/jsref/event_onclick.asp

1
  • ¿En que parte de la pagina se coloca ese código? el 13 dic. 2022 a las 20:04

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.