cross-origin-iframe-helper.html (664B)
1 <!DOCTYPE html> 2 <script> 3 navigation.onnavigate = e => { 4 const message = { 5 navigationType: e.navigationType, 6 cancelable: e.cancelable, 7 canIntercept: e.canIntercept, 8 userInitiated: e.userInitiated, 9 hashChange: e.hashChange, 10 formData: e.formData, 11 destination: { 12 url: e.destination.url, 13 sameDocument: e.destination.sameDocument, 14 key: e.destination.key, 15 id: e.destination.id, 16 index: e.destination.index 17 } 18 }; 19 e.preventDefault(); 20 top.postMessage(message, "*"); 21 }; 22 23 window.onload = () => { 24 if (location.href.includes("postMessage-top-when-done")) { 25 top.postMessage("DONE", "*"); 26 } 27 }; 28 </script>