SO Help: disable f5 and browser refresh using javascript
http://stackoverflow.com/questions/2482059/disable-f5-and-browser-refresh-using-javascript/7997282#7997282
by SpYk3
HTML
<div>
<h2>CLICK HERE TO GIVE THIS BOX FOCUS BEFORE PRESSING F5</h2>
</div>
CSS
html, body { background: #000; color: #FFF; height: 100%; margin: 0; padding: 0; width: 100%; }
div { display: table; height: 100%; width: 100%; }
h2 { display: table-cell; text-align: center; vertical-align: middle; }
JavaScript
function disableF5(e) { if ((e.which || e.keyCode) == 116) e.preventDefault(); };
$(document).on("keydown", disableF5);
// simply visual, let's you know when the correct iframe is selected
$(window).on("focus", function(e) {
$("html, body").css({ background: "#FFF", color: "#000" })
.find("h2").html("THIS BOX NOW HAS FOCUS<br />F5 should not work.");
})
.on("blur", function(e) {
$("html, body").css({ background: "", color: "" })
.find("h2").html("CLICK HERE TO GIVE THIS BOX FOCUS BEFORE PRESSING F5");
});