Source code
Revision control
Copy as Markdown
Other Tools
<!DOCTYPE html>
<meta charset="utf-8">
Popup <input id="input">
<script>
window.onload = async () => {
try {
if (!document.hasFocus()) {
const input = document.getElementById("input");
input.focus();
await new Promise(r => input.onfocus = r);
}
opener.postMessage(`focus = ${document.hasFocus()}`, "*");
} catch(e) {
opener.postMessage(`${e.name}: $(e.message)`, "*");
}
};
</script>
</html>