Source code
Revision control
Copy as Markdown
Other Tools
<!DOCTYPE html>
<script>
'use strict';
window.onmessage = message => {
if (message.data === 'Ready') {
let onSuccess = () => { parent.postMessage('Failure', '*'); };
let onError = error => {
if (error.name == 'InvalidStateError') {
parent.postMessage('Success', '*');
} else {
parent.postMessage('Failure', '*');
}
};
navigator.keyboard.lock().then(onSuccess, onError);
}
};
</script>