-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththird-party-cookies.html
37 lines (32 loc) · 1.13 KB
/
third-party-cookies.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1 id="h1"></h1>
<script>
const cookieTest = (iFrameUri, callBack) => {
const messageHandler = (event) => {
console.log("event", event.data)
if (event.data === "3pcSupported" || event.data === "3pcUnsupported") {
callBack(event.data);
document.body.removeChild(frame);
window.removeEventListener("message", messageHandler);
}
}
const frame = document.createElement("iframe");
frame.id = "3pc";
frame.src = iFrameUri;
frame.style.display = "none";
frame.style.position = "fixed";
document.body.appendChild(frame);
window.addEventListener("message", messageHandler);
}
cookieTest("https://chamithrepo.github.io/create-third-party-cookie/", (data) => {
document.getElementById("h1").innerText = data
console.log(data)
})
</script>
</body>
</html>