iframe-append-2.https.html (580B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <iframe id="id_0"></iframe> 4 <script> 5 window.addEventListener("load", () => { 6 const iframe = document.getElementById("id_0") 7 // Discards the previous document 8 document.documentElement.appendChild(iframe) 9 const xhr = new XMLHttpRequest() 10 // LockManager is created after discarding 11 // At this point the new document is not there yet 12 iframe.contentWindow.navigator.locks.request("weblock_0", () => { 13 xhr.open("GET", "FOOBAR", false) 14 xhr.send() 15 // Now there is a new document 16 }) 17 }) 18 </script>