Silence failures to trigger notifications when not available
Recent Chrome versions are dropping out `new Notification` in favor of `ServiceWorkerRegistration.showNotification`. This makes sure nothing bad happens until we have proper support for Service Workers. See: - https://stackoverflow.com/questions/29774836/failed-to-construct-notification-illegal-constructor - https://stackoverflow.com/questions/31512504/html5-notification-not-working-in-mobile-chrome
This commit is contained in:
parent
837f78f1ae
commit
e21ec8b447
@ -1031,6 +1031,7 @@ $(function() {
|
||||
body = msg.text.replace(/\x02|\x1D|\x1F|\x16|\x0F|\x03(?:[0-9]{1,2}(?:,[0-9]{1,2})?)?/g, "").trim();
|
||||
}
|
||||
|
||||
try {
|
||||
var notify = new Notification(title, {
|
||||
body: body,
|
||||
icon: "img/logo-64.png",
|
||||
@ -1044,6 +1045,10 @@ $(function() {
|
||||
window.setTimeout(function() {
|
||||
notify.close();
|
||||
}, 5 * 1000);
|
||||
} catch (exception) {
|
||||
// `new Notification(...)` is not supported and should be silenced.
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user