Edit in JSFiddle

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");
});
<div>
    <h2>CLICK HERE TO GIVE THIS BOX FOCUS BEFORE PRESSING F5</h2>
</div>
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; }