I was able to capture the event but, only in the case of F5, how do I prevent and Reload by the button too??
Example of how I did, to capture F5:
ngOnInit() {
window.addEventListener("keyup", this.disableReloadPage);
window.addEventListener("keydown", this.disableReloadPage);
}
disableReloadPage(e) {
if ((e.which || e.keyCode) === 116) {
alert("Não é possível recarregar essa página!");
e.preventDefault();
}
}