I want to capture the Ctrl-R or F5 shortcut on the browser to prevent it from performing a browser refresh, but instead perform a custom refresh.
I was able to capture Ctrl-R on Safari and FF using:
document.onkeypress = function(e){
if ((e.ctrlKey || e.metaKey) && e.keyCode == 114) // Ctrl-R
e.preventDefault();
}
But that doesn't work on IE. Is there any way to do this on IE?
Update: For people who are asking why I am doing this in the first place: I just wanted to do a custom app refresh, but wanted to avoid having a "refresh" button because I kinda discourage using the refresh (We have a full page flex app). We ended up switching to F8 because F5 was just too hard to get working on all browsers.