The Keyboard Lock and the Pointer Lock APIs require permission from Chrome 131
bookmark_borderbookmark
Stay organized with collections
Save and categorize content based on your preferences.
Thomas Steiner
The Keyboard Lock API lets developers provide an immersive, full screen experience for a variety of use cases, including interactive websites, games, and remote desktop or application streaming. It does so by enabling websites to use all available keys allowed by the host operating system.
The Pointer Lock API lets a desktop application hide the pointer icon and interpret mouse motion for something else, like looking around in a 3D world.
From Chrome 131, using either of these two APIs requires permission. You can check for permission as shown in the following snippets:
const{state}=awaitnavigator.permissions.query({name:'pointer-lock'});if(state==='granted'){// The Pointer Lock API can be used.}
const{state}=awaitnavigator.permissions.query({name:'keyboard-lock'});if(state==='granted'){// The Keyboard Lock API can be used.}
There's no explicit need to ask for permission. If permission wasn't granted before, the browser will show a permission prompt upon the first request to lock the pointer or the keyboard.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-10 UTC."],[],[]]