summaryrefslogtreecommitdiff
path: root/client.html
blob: 9150a7aaef7f3e6ddf4552f91921298b51660589 (plain)
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
<meta charset="UTF-8">
<body onload="getNotPerm()">
<script>
function handlePermissions(result) {
	console.log("Permission "+ result);
	permissionDisplay = document.getElementsByClassName("pd")[0];
	grantedMsg = "You have granted notification permissions";
	deniedMsg = "You have not  granted notification permissions";
	if(result == "granted"){
		permissionDisplay.innerHTML = grantedMsg;
	} else {
		permissionDisplay.innerHTML = deniedMsg;
	}
	poop = result;
	return;
}
function getNotPerm() {
	Notification.requestPermission().then(handlePermissions);
	Notification.requestPermission();
	navigator.serviceWorker.register('/sw.js');
	return;	
}
function notify() {
	msg = new Notification("あなたはチンチンが大好き");
	msg.show();
}
</script>
<!--- Permission display-->
<p class="pd">You have not granted notification permissions</p>
<button onclick="getNotPerm()">Re-request Notification Permissions</button>
<button onclick="notify()">Send Notifications</button>
</body>