child-navigates-parent-cross-origin-inner.html (505B)
1 <!doctype html> 2 <script> 3 const params = new URL(window.location).searchParams; 4 const property = params.get("property"); 5 6 try { 7 if (property === null) { 8 parent.location = "foo"; 9 } else if (property === "reload") { 10 parent.location.reload(); 11 } else if (property === "replace") { 12 parent.location.replace("foo"); 13 } else { 14 parent.location[property] = "foo"; 15 } 16 parent.parent.postMessage("success", "*"); 17 } catch (e) { 18 parent.parent.postMessage(`error: ${e.name}`, "*"); 19 } 20 </script>