Comment modifier l’heure de fermeture de la notification de bureau HTML5 pour ne pas l’autoclose?

Je travaille avec la notification de bureau HTML5. cela fonctionne bien et me donne la sortie appropriée selon mes exigences. Maintenant, je veux afficher cette notification jusqu’à ce que l’utilisateur ferme cette notification manuellement. Comment est-il possible que mon code soit le suivant?

function notifyMe() { if (!("Notification" in window)) { alert("This browser does not support desktop notification"); } else if (Notification.permission === "granted") { var options = { body: "due to your inactive response timer is stoped automatically. Start your timer again.", dir : "ltr" }; var notification = new Notification("Your timer is stop",options); } else if (Notification.permission !== 'denied') { Notification.requestPermission(function (permission) { if (!('permission' in Notification)) { Notification.permission = permission; } if (permission === "granted") { var options = { body: "due to your inactive response timer is stoped automatically. Start your timer again.", dir : "ltr" }; var notification = new Notification("Your timer is stop",options); } }); } } 

Il rest indéfiniment sur Chrome. Il y a un bogue dans Firefox qui le ferme automatiquement après 4 secondes: https://bugzilla.mozilla.org/show_bug.cgi?id=875114

Essayez avec “requireInteraction” dans l’option, fonctionnera sous Firefox et Chrome à la fois. Le code est:

 var options = { body: "due to your inactive response timer is stoped automatically. Start your timer again.", dir : "ltr", requireInteraction: true };