리치 데스크톱 알림을 사용하여 중요한 일이 발생했음을 사용자에게 알립니다. 알림
브라우저 창 외부에 표시됩니다. 다음 스냅샷에 나와 있는 것처럼
표시되는 위치는 플랫폼에 따라 다릅니다
JavaScript 및 선택적으로 패키징된 HTML 페이지를 사용하여 알림 창을 만듭니다.
로 설정합니다.
예
먼저 매니페스트에서 notifications 권한을 선언합니다.
{"name":"Myextension","manifest_version":2,..."permissions":["notifications"
],...// Note: Because of bug 134315, you must declare any images you// want to use with createNotification() as a web accessible resource."web_accessible_resources":["48.png"
],}
그런 다음 webkitNotifications 객체를 사용하여 알림을 만듭니다.
// Note: There's no need to call webkitNotifications.checkPermission().// Extensions that declare the notifications permission are always// allowed create notifications.// Create a simple text notification:varnotification=webkitNotifications.createNotification('48.png',// icon url - can be relative'Hello!',// notification title'Loremipsum...'// notification body text);// Or create an HTML notification:varnotification=webkitNotifications.createHTMLNotification('notification.html'// html url - can be relative);// Then show the notification.notification.show();