diff options
author | Haoran S. Diao <0@hairydiode.xyz> | 2019-11-21 22:29:45 -0800 |
---|---|---|
committer | Haoran S. Diao <0@hairydiode.xyz> | 2019-11-21 22:29:45 -0800 |
commit | 690eba96ae63b8f18d8de1b6557336981b0a63a4 (patch) | |
tree | 1809f78801383447109d78f1fca7c2d51a78c24e /client.html |
Initial Commit
Diffstat (limited to 'client.html')
-rw-r--r-- | client.html | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/client.html b/client.html new file mode 100644 index 0000000..9150a7a --- /dev/null +++ b/client.html @@ -0,0 +1,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> |