iframe.html (706B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Helper functions invoked by a nested browsing context</title> 4 <link rel="author" title="Tomoyuki Shimizu" href="https://github.com/tomoyukilabs"> 5 <link rel="help" href="https://w3c.github.io/presentation-api/#monitoring-incoming-presentation-connections"> 6 7 <script> 8 window.addEventListener('message', event => { 9 const data = event.data; 10 11 if (!data.type) 12 return; 13 else if (data.type === 'connect') { 14 const request = new PresentationRequest(data.url); 15 request.reconnect(data.id).then(c => { 16 c.onterminate = () => { 17 window.parent.postMessage({ type: 'terminated' }, '*'); 18 }; 19 }); 20 } 21 }); 22 </script>