blob: a94af6b9fbae67eb010037187fb6f3350a3c0b5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>iframe active element inner document</title>
</head>
<body>
<h1>Inner</h1><br>
<input></input>
<script>
let innerlog = "innerlog:";
window.onmessage = function(e) {
if (e.data == "getlog") {
parent.postMessage(innerlog, "*");
}
};
window.onfocus = function() {
innerlog += "windowfocus,";
};
window.onblur = function() {
innerlog += "windowblur,";
innerlog += "activeElement:" + document.activeElement.tagName + ",";
};
let input = document.querySelector("input");
window.onload = function() {
innerlog += "willfocusinput,";
input.focus();
innerlog += "didfocusinput,";
innerlog += "activeElement:" + document.activeElement.tagName + ",";
parent.postMessage("ready", "*");
};
</script>
</body>
</html>
|