trisquel-icecat/icecat/dom/serviceworkers/test/page_post_controlled.html

27 lines
617 B
HTML

<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script type="text/javascript">
window.parent.postMessage({
controlled: !!navigator.serviceWorker.controller
}, "*");
addEventListener("message", e => {
if (e.data == "create nested iframe") {
const iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.src = location.href;
} else {
window.parent.postMessage(e.data, "*");
}
});
</script>
</body>
</html>