Keyboard Map (layout leak)
Reveals the physical-to-printed key mapping, i.e. the keyboard layout.
In one line
Can tell your keyboard layout, which hints at your country and language
Reveals the physical-to-printed key mapping, i.e. the keyboard layout.
Shows which keyboard layout the person uses (QWERTY, AZERTY, Dvorak, language), a strong locale and fingerprint signal. No prompt.
What it can and can't do
What the user does: Nothing. It happens when the page or app loads
It can
- Check which character each physical key produces
- Guess your language or region from that layout
- Add to a profile of your device to help recognise you
It cannot
- See what you type
- Work in Firefox or Safari
- Show a permission pop up; there is none
- Work outside secure (https) pages
How it differs between platforms: Only Chrome and Edge on desktop support it. Firefox, Safari and most phones do not.
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 69 | 2018-09-04 | None |
| Edge | Supported | 79 | 2020-01-15 | None |
| Firefox | Not supported | Not available | Not listed | None |
| Safari | Not supported | Not available | Not listed | None |
| Safari on iPhone | Not supported | Not available | Not listed | None |
| Chrome on Android | Not supported | Not available | Not listed | None |
| Samsung Internet | Not supported | Not available | Not listed | None |
How a site asks for it
| API | navigator.keyboard.getLayoutMap() |
| Permissions policy | keyboard-map |
| Browser compat keys | api.Keyboard.getLayoutMap |
| How access is granted | none |
| What the user sees | No prompt; Chromium exposes it to secure contexts. |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | No |
| How long it lasts | n/a |
| How to take it back | n/a |
| Inside an iframe | Needs allow="keyboard-map" |
Typical flow
- Call getLayoutMap()
- Read KeyboardLayoutMap of key codes to characters
Data you get
What comes back: KeyboardLayoutMap
Shape: object
How often: on call
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
entries | integer | keys | about 48 mappable keys | 1 |
Technical limits
- Chromium only
- No key press data
The story
What it is
Reveals which physical key makes which letter, so the page learns your keyboard layout.
For you
You see nothing. The page quietly learns whether your keyboard is QWERTY, AZERTY, Dvorak or another layout. No prompt appears. It may be used to guess your country.
For makers
Makers of games and editors use it for correct key labels. Fraud and tracking systems also use it as a free hint to your language, and in a fingerprint it adds a few bits of uniqueness.
Where you see it
| Type | Example | Apps |
|---|---|---|
| games | A browser game rebinds its movement keys to fit a Dvorak or AZERTY keyboard so players are not stuck with wrong keys. | Krunker.io, Minecraft Classic |
| creative | A music web app maps piano keys to the correct physical row on any layout. | Soundtrap, BandLab |
| ads | An ad network adds the layout to a profile and guesses a user's language when other signals are missing. | None named |
| analytics | A fingerprinting script mixes layout, fonts and screen size to spot returning visitors. | None named |
| security | A fraud engine flags an order that claims to be in Germany but types on a Russian layout. | None named |
| developer | A coding web app shows the correct shortcut key names for each layout. | None named |
Risks
- Layout hints at country
- No prompt
Good uses and abuse
Legitimate uses
- Showing correct key hints in games
Known abuse
- Layout fingerprinting
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 2 of 5 | How revealing the data is |
| Utility | 2 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | 3 | Rough identifying entropy, when known |
History
- 2018-09, Chrome 69: Keyboard Map ships
Related capabilities
Related
- Keyboard Lock. Can capture keys like Escape and Alt+Tab while the page is full screen
Sources
How well checked: Based on official documentation.