Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1521 How can I cancel the users F5 request to refresh the page in Internet Explorer?

irt.org | Knowledge Base | JavaScript | Event | Q1521 [ previous next ]

Q1521 How can I cancel the users F5 request to refresh the page in Internet Explorer?

Do it by redirecting the keyboard action on another keycode that you can control (backspace in this example):

function cancelRefresh() {
  // keycode for F5 function
  if (window.event && window.event.keyCode == 116) {
    window.event.keyCode = 8;
  }
  // keycode for backspace
  if (window.event && window.event.keyCode == 8) {
    // try to cancel the backspace
    window.event.cancelBubble = true;
    window.event.returnValue = false;
    return false;
  }
}

This function is called on the onKeyDown event and it seems to work!

Feedback on 'Q1521 How can I cancel the users F5 request to refresh the page in Internet Explorer?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.