Disable Alt features (shortcuts) in Google Chrome

I use the following code (as a shortcut) to redirect users to my reviews page.

<a href='/feedback/' accesskey='f'>feedback</a> 

But this code does not work in Google Chrome, because when the user press Alt + F , he will open the Google Chrome menu bar.

How to disable these "shortcuts"?

It could be jQuery, javascript ...

Note. I wrote javascript code that redirects, but first opens the Chrome menu bar and then does its job.

0
javascript jquery html google-chrome keyboard-shortcuts
source share
4 answers

I just found a way to disable browser features when the user presses the Alt + other button . Javascript can disable these shortcuts by writing return false at the end of the function

Example

 function function1(){/* code goes here */; return false} 
+1
source share

There are certain special keys reserved, and Alt + F is one of them, but it will really change between browsers and operating systems. Here is a good article .

+2
source share

Browsers that allow this to theoretically expose security vulnerabilities. If it is possible to override the behavior of the "system", you can capture the users browser. He will be able to display a fake File menu, which mimics the real one, and makes the user think that they are interacting with their local machine, and not with the website.

Because of this, this is not possible in most modern browsers.

+2
source share

In Google Chrome (tested in V44), the modifier key for accessing the accesskey shortcuts is Alt .

However, if a key conflicts with a browser shortcut , it is accessed using Alt Shift . So, the solution you posted works, but only with Alt Shift .

Example:

  • The first link is accessed using Alt Shift + f (conflict with the menu shortcut)
  • Access to the second link is done using Alt + a (no conflicts)

 <h1>Links with accesskey attribute</h1> <a href='http://www.example.org/' accesskey='f'> Link to www.example.org (accesskey: f) </a> <p/> <a href='http://apache.org/' accesskey='a'> Link to apache.org (accesskey: a) </a> 

By the way, I prefer to use the Firefox solution, which should always use Alt Shift for these shortcuts. This is more consistent for users than the behavior of Chrome (although Chome developers may have had their own reasons).


Note. The above action applies to Windows and Linux. AFAIK, Chrome on Mac OS X uses various shortcuts.

+2
source share

All Articles