document.addEventListener('DOMContentLoaded', () => {
  history.pushState({ page: location.pathname }, "", location.href);

  window.addEventListener("popstate", function () {
    const confirmar = confirm("Se cerrará tu sesión. ¿Estás seguro de regresar? ");
    if (confirmar) {
      window.location.href = "logout.php";
    } else {
      history.pushState(null, "", location.href);
    }
  });
});
