Reputation: 139
$("body").keydown(function(e) {
if (e.which == 116) {
window.location.href = "google.com";
}
});
I used this code so that every-time someone press f5 it will force them to go to other URL. I tested this with Chrome and it worked fine but with FireFox, nothing happens.
Please help me with this.
Thank you!
Upvotes: 0
Views: 268
Reputation: 608
this is working fine
$(function() {
$("body").keydown(function(e) {
e.preventDefault();
if (e.which == 116) {
window.location.href = "http://google.com";
}
});
});
Upvotes: 1