LoginSignup
6
6

More than 5 years have passed since last update.

HTML5 Web Notification を試す

Posted at

Mountain Lion の Safari 6 の設定に「通知」というのがあって、気になったので調べた。

  • Web Notification 自体は Apple の PUSH 通知とは独立してる W3C 仕様
  • Mountain Lion で通知センターが導入されたので連動するようになった

実際に試すには、インスペクタで

javascript
window.Notification.requestPermission(function(permission){ console.debug(permission) })
new window.Notification("hello")

そうすると、通知センターに出ます。

Webサイトを開いていなくても通知される PUSH 通知的なものを期待していたのでガッカリですが、裏側にでも開いていれば通知されるので使いようなのかなと思います。 Ajax リクエストの重い処理が完了したら通知するとか。

ちなみに、 iOS 6 の Mobile Safari リモートインスペクタ経由で window.Notification にアクセスしようとすると "undefined" でした。

参考資料

https://developer.apple.com/library/safari/#documentation/AppleApplications/Conceptual/SafariJSProgTopics/Articles/SendingNotifications.html
http://dvcs.w3.org/hg/notifications/raw-file/tip/Overview.html
http://dangercove.github.com/html5-notifications/

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6