我正在使用 gitpod 测试我使用 firebase 在 DJnago 中设置的推送通知。一切顺利,但最后没有出现请求权限对话框。我不确定是什么原因。
我遵循的链接是这个:
https://blog.hipolabs.com/testing-push-notifications-locally-with-firebase-ef052531af03
它应该是这样的:
但在我看来是这样的:
我的请求权限按钮不见了。我做了几次尝试,但结果相同。index.html 文件如下所示:
function requestPermission() {
console.log('Requesting permission...');
Notification.requestPermission().then((permission) => {
if (permission === 'granted') {
console.log('Notification permission granted.');
// TODO(developer): Retrieve a registration token for use with FCM.
// In many cases once an app has been granted notification permission,
// it should update its UI reflecting this.
resetUI();
} else {
console.log('Unable to get permission to notify.');
}
});
}