Debug Notification API failures
This commit is contained in:
parent
2be90b4a81
commit
a8dda91c3c
|
@ -1562,6 +1562,16 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
|||
$pushEnableButton = document.querySelector("#grant-push-permission"),
|
||||
$pushDeniedHelp = document.querySelector("#push-denied-help");
|
||||
|
||||
// Is the Notification API unavailable?
|
||||
if (typeof(window.Notification) === "undefined") {
|
||||
$pushStatusDefault.innerHTML = `<i class="fa fa-xmark mr-1"></i> Notification API unavailable`;
|
||||
$pushStatusDefault.style.display = "";
|
||||
return;
|
||||
}
|
||||
|
||||
// And testing widely for errors...
|
||||
try {
|
||||
|
||||
// Get the current permission status: default, granted, denied.
|
||||
const showPermission = (permission) => {
|
||||
$pushStatusGranted.style.display = "none";
|
||||
|
@ -1604,6 +1614,10 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
|||
}
|
||||
});
|
||||
});
|
||||
} catch(err) {
|
||||
$pushStatusDefault.innerHTML = `<i class="fa fa-xmark mr-1"></i> Error: ${err}`;
|
||||
$pushStatusDefault.style.display = "block";
|
||||
}
|
||||
});
|
||||
|
||||
// Location tab scripts.
|
||||
|
|
Loading…
Reference in New Issue
Block a user