iframe-that-tries-to-navigate-parent-and-sends-result-to-grandparent.html (455B)
1 <!DOCTYPE html> 2 <p>This is a frame that tries to navigate its parent.</p> 3 <script> 4 window.onload = function() { 5 try { 6 parent.location.href = "data:text/html,\u003c!DOCTYPE html\u003e\u003cp\u003eIf this message appears, then this frame has been navigated by its child.\u003c/p\u003e\u003cscript\u003eparent.postMessage('can navigate', '*');\u003c/script\u003e"; 7 } catch(e) { 8 parent.parent.postMessage("can not navigate", "*"); 9 } 10 } 11 </script>