blob: 25bc2037c3a29358539a401fd2c8cd005d2d1b2e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<!DOCTYPE HTML>
<html>
<head>
<title>User activation popup</title>
</head>
<body>
<iframe sandbox="allow-top-navigation-by-user-activation allow-scripts allow-same-origin"></iframe>
<script>
window.addEventListener("message", (e) => {
if (e.data === "triggerIframeLoad") {
// Load into the the iframe a script which notifies the opener of top level navigation or if it was prevented.
let script = `window.opener.postMessage("topNavigation");`;
frames[0].frameElement.src = `javascript:try{window.top.location='javascript:${encodeURIComponent(script)}';} catch (e) {window.top.opener.postMessage("topNavigationBlocked");}`;
} else {
window.opener.postMessage("unexpected");
}
});
</script>
</body>
</html>
|