-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
41 lines (39 loc) · 1.06 KB
/
index.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
<!doctype html>
<html lang="en">
<head>
<title>hello</title>
<script>
function foo() {
let auth = {
homeURL: "home url",
authURL: "auth url",
title: "title",
webToken: "web token",
likesURL: "likes url",
videosURL: "videos url",
mobileTokenURL: "mobile token",
};
return encodeURIComponent(JSON.stringify(auth));
}
function go() {
console.log("hi");
console.log(foo());
window.webkit.messageHandlers.sendAuthData.postMessage(foo());
}
</script>
<style>
.center {
padding: 70px 0;
border: 3px solid green;
}
</style>
</head>
<body>
<div class="center">
<button type="button" onclick="window.close();">close</button>
<button type="button" onclick="window.location = 'callback://somehost?greeting=hello'">redirect</button>
<button type="button" onclick="go()">post message</button>
<button type="button" onclick="window.webkit.messageHandlers.close.postMessage(null);">simple send</button>
</div>
</body>
</html>