Android上的Chrome上会显示通知的位置?

Geo*_*mms 16 javascript notifications android google-chrome

考虑以下.

if (this.Notification) {
  Notification.requestPermission(function(permission) {
    if (permission === 'granted') {
      return new Notification('hi this is a test');
    } else {
      return alert("Notifications not permitted");
    }
  });
} else {
  alert('Notifications not supported');
}
Run Code Online (Sandbox Code Playgroud)

JSFiddle.

这似乎与桌面版Chrome中的预期一致.在Firefox for Android中,此类通知会显示在Android通知栏中.

但是在Android Chrome上,它似乎会提示用户允许/禁止通知,但如果用户点击"允许"似乎没有任何结果.Android Chrome是否支持此类通知?

编辑:与18个月前的这个问题不同- 然后window.Notification根本没有定义.现在它被定义但似乎没有做任何事情.

Swi*_*ger 2

我认为这与以下问题重复HTML5 Notification notworking in Mobile Chrome。当我在 Android 设备上调试它时,出现以下错误:

Failed to construct 'Notification': Illegal constructor. Use ServiceWorkerRegistration.showNotification()