如何使用Java重置通知权限?我为此启用他们:
var prm = Notification.permission;
if (prm == 'default' || prm == 'denied') {
Notification.requestPermission().then(function (permission) {
if (permission === "denied") {
$($('#notification-toggle')).prop('checked', false)
$('#notification-toggle-callback').html('Notification permissions are blocked.')
} else {
var notification = new Notification('Test Notification', {
icon: 'https://jailibrary.github.io/images/favicon/favicon-96x96.png',
body: 'Hey there! Notifications are now enabled.',
});
}
});
}
我希望这样,如果用户允许通知,但后来决定禁用它们,我将如何重置权限?谢谢