sizing-target.html (699B)
1 <!DOCTYPE html> 2 <meta name="viewport" content="width=device-width,initial-scale=1"> 3 <script> 4 const windowProps = ["innerWidth", "innerHeight"]; 5 const windowPropsObj = {}; 6 const channelName = location.search.substr(1); 7 const channel = new BroadcastChannel(channelName); 8 for (const prop of windowProps) { 9 windowPropsObj[prop] = window[prop]; 10 } 11 channel.postMessage(windowPropsObj); 12 13 // Because messages are not delivered synchronously and because closing a 14 // browsing context prompts the eventual clearing of all task sources, this 15 // document should not be closed until the opener document has confirmed 16 // receipt. 17 channel.onmessage = () => { window.close() }; 18 </script>