sandbox-self.html (792B)
1 <!DOCTYPE html> 2 <title>Return fullscreen feature policy state from self and a sandboxed child frame</title> 3 <script> 4 "use strict"; 5 window.onload = () => { 6 let frame = document.createElement('iframe'); 7 frame.src = "/feature-policy/resources/nested-sandbox.html"; 8 frame.sandbox = "allow-scripts"; 9 10 var handle_message = evt => { 11 if (evt.source === frame.contentWindow) { 12 window.parent.postMessage({ 13 "child": document.featurePolicy.allowedFeatures().includes("fullscreen"), 14 "grandchild": evt.data 15 },"*"); 16 document.body.removeChild(frame); 17 window.removeEventListener('message', handle_message); 18 } 19 }; 20 window.addEventListener('message', handle_message); 21 document.body.appendChild(frame); 22 }; 23 </script>