I have to prevent the back button and throughs an alerts it will be working on the Mac environment with browsers are firefox and chrome but safari is not triggering the function .i have been given below snippets.
const neutralizeBack = () => {
history.pushState(null, "", location.href);
window.onpopstate =() =>{
// window.history.pushState(null, "", location.href);
addBody(<RevertAlertModal close={() => hideModal()} />);
showModal("primary");
};
}