blob: afd5601a523ff0a1d60d37b171b2098a38600ace (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<!DOCTYPE html>
<input id="target" value="This should be unfocused!" autofocus></input>
<script>
let got_focus = false;
document.getElementById("target").addEventListener("focus", () => {
got_focus = true;
});
window.addEventListener("load", () => {
parent.postMessage("child_loaded", "*");
});
window.addEventListener("message", event => {
if (event.data == "report_focus_state") {
let msg = got_focus ? "child_is_focused" : "child_is_not_focused";
parent.postMessage(msg, "*");
}
});
</script>
|