-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopupclose.html
More file actions
62 lines (54 loc) · 1.65 KB
/
Copy pathpopupclose.html
File metadata and controls
62 lines (54 loc) · 1.65 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<head>
<meta name="robots" content="noindex" />
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Genesys PKCE Auth</title>
<meta name="Template" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body onload="start()">
<script>
'use strict' //Enables strict mode is JavaScript
async function start() {
try {
let authMessage = {
name: "gc_popup_msg",
hash: "",
search: ""
};
if (window.location.hash) authMessage.hash = window.location.hash;
if (window.location.search) authMessage.search = window.location.search;
// window.addEventListener('message', (event) => {
// console.log("from event:");
// console.log(event.origin);
// console.log("from parent:");
// console.log(window.parent.location.origin);
// event.source.postMessage(authMessage, event.origin);
// // Force close
// console.log('Continues....');
// let closeTimeout = setTimeout(
// function () {
// window.close();
// },
// 2000
// );
// })
console.log(`parent location origin: ${window.parent.location.origin}`);
window.opener.postMessage(authMessage, '*');
// Force close
console.log('Continues....');
let closeTimeout = setTimeout(
function () {
window.close();
},
2000
);
} catch (err) {
console.log('Error: ', err)
}
}
</script>
</body>
</html>