Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
chrome notification bug reproduction
<p> Note: You need to open via an http server for notifications to work. </p>
<input id='the-input'>
<div id='timer'>timer</div>
<script type="text/javascript">
start_time = new Date()
setInterval(function() {
document.getElementById('timer').textContent = Math.floor(
(new Date() - start_time) / 1000)
}, 1000)
if (!("Notification" in window))
console.log("This browser does not support desktop notification")
if (Notification.permission !== 'granted')
Notification.requestPermission(function (permission) {
console.log('permission:', permission)
Notification.permission = permission;
function show_notification() {
if (Notification.permission === "granted") {
this.notification && this.notification.close()
this.notification = new Notification("Hi there!");
this.notification.onclick = function(x) {
// this.cancel();
setTimeout(show_notification, 10000)
setTimeout(show_notification, 10000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.