navigator-keyboard-lock-inner.html (708B)
1 <!DOCTYPE html> 2 <script src="utils.js"></script> 3 <title>Fenced frame content to report the value of navigator.keyboard.lock</title> 4 5 <body> 6 <script> 7 async function init() { // Needed in order to use top-level await. 8 // This file is meant to be navigated to from a <fencedframe> element. It 9 // reports back to the page hosting the <fencedframe> whether or not 10 // `keyboard.lock` is allowed. 11 const [keyboard_lock_key] = parseKeylist(); 12 // Report whether or not `navigator.keyboard.lock()` is allowed. 13 navigator.keyboard.lock().then( 14 () => { writeValueToServer(keyboard_lock_key, "resolved"); }, 15 () => { writeValueToServer(keyboard_lock_key, "rejected");}, 16 ); 17 } 18 19 init(); 20 </script> 21 </body>