接上篇,當 Limit 到達上限值時,想要彈跳視窗使用時
需要在 manifest.json 裡面的 permissions 增加 notifications
"permissions" : [
"storage",
"notifications"
]
使用 chrome api 創建 notification
var notifOptions = {
type : 'basic',
iconUrl : 'icon48.png',
title : 'Limit reached',
message : "you're reached your limit!"
}
chrome.notifications.create('limitNotif',notifOptions);
完整程式碼 :

執行結果,當超過設定的上限時,會彈跳視窗

