Results 1 to 2 of 2

Thread: JavaScript to disable f5 button

  1. #1
    Join Date
    Apr 2010

    JavaScript to disable f5 button

    i am using below code to disable f5 button
    document.attachEvent("onkeydown", my_onkeydown_handler);
    function my_onkeydown_handler()
    switch (event.keyCode)

    case 116 : // 'F5'
    event.returnValue = false;
    event.keyCode = 0;
    window.status = "We have disabled F5";

    but it is not working
    can any one help me with a better one

    Thanks in Advance.

  2. #2
    Join Date
    Dec 2003
    Bucharest, ROMANIA
    There are some special keys (most of the functions and combination of) which, even if they can be captured in javascript, can not be stopped/disabled. Some of them are controlled only by the Operating System. For instance, for a Windows PC: Alt+F4. or CTRL+ALT+DELETE.

    It is absolutely logical. You can not prevent the owner of a PC from closing his browser, can you?

    It looks like F5 is one of those keys

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles