replace-document-root-and-refocus-window.html (466B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <script> 6 document.addEventListener("DOMContentLoaded", () => { 7 document.designMode = "on"; 8 let win; 9 try { 10 win = top.open("data:text/html,This is new window"); 11 } catch (e) { 12 } 13 document.designMode = "off"; 14 document.documentElement.innerHTML = document.documentElement.innerHTML; 15 win?.close(); 16 focus(); 17 }, {once: true}); 18 </script> 19 </head> 20 <body> 21 <small contenteditable></small> 22 </body> 23 </html>