Source code

Revision control

Copy as Markdown

Other Tools

<!doctype html>
<meta charset="utf-8">
<title>iframe.focus() with different-site intermediate frame outer</title>
<script>
let log = "";
function getLog() {
return log;
}
window.onmessage = function(e) {
log += e.data;
};
window.onload = function() {
log += "outeronload;";
log += "outeractivelement:" + document.activeElement.localName + ";";
document.getElementsByTagName("iframe")[0].contentWindow.postMessage("starttest;", "*");
setTimeout(function() {
log += "outeractivelement:" + document.activeElement.localName + ";";
opener.postMessage(getLog(), "*");
}, 3000);
}
</script>