Preferably using JavaScript but would like to hear other ways too
This will disable F5, but not the actual refresh function:
document.onkeydown = function (e) { if (e.keyCode === 116) { return false; } };
On Chrome/XP, at least.