From 57f0abe37096e416062f2ff19b2fe013aa7547bb Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Sun, 22 Oct 2017 10:50:36 -0400 Subject: [PATCH] Add notification support to a few older browsers and Safari --- evennia/web/webclient/static/webclient/js/webclient_gui.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/evennia/web/webclient/static/webclient/js/webclient_gui.js b/evennia/web/webclient/static/webclient/js/webclient_gui.js index ba657858d9..849993dd75 100644 --- a/evennia/web/webclient/static/webclient/js/webclient_gui.js +++ b/evennia/web/webclient/static/webclient/js/webclient_gui.js @@ -374,7 +374,10 @@ function onNewLine(text, originator) { document.title = "(" + unread + ") " + originalTitle; if ("Notification" in window){ if (("notification_popup" in options) && (options["notification_popup"])) { - Notification.requestPermission().then(function(result) { + // There is a Promise-based API for this, but it’s not supported + // in Safari and some older browsers: + // https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission#Browser_compatibility + Notification.requestPermission(function(result) { if(result === "granted") { var title = originalTitle === "" ? "Evennia" : originalTitle; var options = {