files/en-us/web/api/keyboard/getlayoutmap/index.md
{{APIRef("Keyboard API")}}{{SeeCompatTable}}{{securecontext_header}}
The getLayoutMap() method of the
{{domxref("Keyboard")}} interface returns a {{jsxref('Promise')}} that resolves with
an instance of {{domxref('KeyboardLayoutMap')}} which is a map-like object with
functions for retrieving the strings associated with specific physical keys.
getLayoutMap()
None.
A {{jsxref('Promise')}} that resolves with an instance of {{domxref('KeyboardLayoutMap')}}.
SecurityError {{domxref("DOMException")}}
The following example demonstrates how to get the location- or layout-specific string associated with the key that corresponds to the 'W' key on an English QWERTY keyboard.
const keyboard = navigator.keyboard;
keyboard.getLayoutMap().then((keyboardLayoutMap) => {
const upKey = keyboardLayoutMap.get("KeyW");
window.alert(`Press ${upKey} to move up.`);
});
{{Specifications}}
{{Compat}}