-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwooidc_rpframe.html
44 lines (42 loc) · 1.54 KB
/
wooidc_rpframe.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
38
39
40
41
42
43
<html>
<head>
<script>
var stat = "unchanged",
params = parseQueryString(window.location.search.substring(1)),
targetOrigin = params.target,
mes = params.client_id + " " + params.session_state;
window.addEventListener("message", receiveMessage, false);
function parseQueryString ( queryString ) {
var params = {}, queries, temp, i, l;
// Split into key/value pairs
queries = queryString.split("&");
// Convert the array of strings into an object
for ( i = 0, l = queries.length; i < l; i++ ) {
temp = queries[i].split('=');
params[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1]);
}
return params;
}
function check_session()
{
var win = window.parent.document.getElementById("opFrame").contentWindow;
win.postMessage( mes, targetOrigin);
}
function setTimer()
{
check_session();
timerID = setInterval("check_session()",3*1000);
}
function receiveMessage(e)
{
if (e.origin !== targetOrigin ) {
return;
}
stat = e.data;
if (stat == "changed") {
window.parent.wooidcLogout();
}
}
</script>
</head>
</html>