Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 357353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:11:51+00:00 2026-05-12T12:11:51+00:00

I want to capture the Ctrl – R or F5 shortcut on the browser

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T12:11:51+00:00Added an answer on May 12, 2026 at 12:11 pm

    Open JavaScript

    http://www.openjs.com/scripts/events/keyboard_shortcuts/

    For certain keys (F1, F4), you have to open a new browser window without the address bar.

    Example

    Open a new window, without adornments:

    window.open( 'webpage.html', 'TLA', 
    'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=665' );
    

    JavaScript to use the library:

    var FALSE_FUNCTION = new Function( "return false" );
    
    /**
     * Called to disable F1, F3, and F5.
     */
    function disableShortcuts() {
      // Disable online help (the F1 key).
      //
      document.onhelp = FALSE_FUNCTION;
      window.onhelp = FALSE_FUNCTION;
    
      // Disable the F1, F3 and F5 keys. Without this, browsers that have these
      // function keys assigned to a specific behaviour (i.e., opening a search
      // tab, or refreshing the page) will continue to execute that behaviour.
      //
      document.onkeydown = function disableKeys() {
        // Disable F1, F3 and F5 (112, 114 and 116, respectively).
        //
        if( typeof event != 'undefined' ) {
          if( (event.keyCode == 112) ||
              (event.keyCode == 114) ||
              (event.keyCode == 116) ) {
            event.keyCode = 0;
            return false;
          }
        }
      };
    
      // For good measure, assign F1, F3, and F5 to functions that do nothing.
      //
      shortcut.add( "f1", FALSE_FUNCTION );
      shortcut.add( "f3", FALSE_FUNCTION );
      shortcut.add( "f5", FALSE_FUNCTION );
    }
    

    Inside webpage.html:

    <body onload="disableShortcuts();">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to capture the Ctrl + C ( SIGINT ) signal sent from
I want to capture the errors from a script into a file instead of
I want to capture a single image from my webcam and save it to
I want to capture the browser window/tab close event. I have tried the following
I want to capture the print event from my asp.net web application and also
I want to capture two events from a relativeLayout. When the user clicks it
I want to capture sound from mic and play it again in speakers in
I want to capture output from two concurrent programs (tails on logfiles) into one
I want to capture when one app is closed from springboard to make one
I want to capture packets from 10Gbps network card with 0 packet loss. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.