2013-03-14 75 views
3

我有webkit通知工作完美,但我想讓用戶選擇切換它們,如果他們發現他們討厭。谷歌Chrome瀏覽器webkit通知撤消權限?打開/關閉?

我已經搜索了API,但找不到任何與撤消權限有關的事情。

基本的東西,看起來像下面...

<input type="button" onclick="window.webkitNotifications.requestPermission();" value="Yes" /> 
<input type="button" onclick="window.webkitNotifications.revokePermission();" value="No" /> 

回答

4

不能撤銷通知的權限,他們只能使用每頁面的基礎上鍍鉻的配置 設置»高級設置»保密設置,撤銷»內容設置»通知。

如果你不想顯示它們,你將需要跟蹤用戶的選擇,而不是創建通知,而不是撤銷權限。

這裏是鉻API:

interface NotificationCenter { 
// Notification factory methods. 
Notification createNotification(in DOMString iconUrl, in DOMString title, in DOMString body) throws(Exception); 
optional Notification createHTMLNotification(in DOMString url) throws(Exception); 

// Permission values 
const unsigned int PERMISSION_ALLOWED = 0; 
const unsigned int PERMISSION_NOT_ALLOWED = 1; 
const unsigned int PERMISSION_DENIED = 2; 

// Permission methods 
int checkPermission(); 
void requestPermission(in Function callback); 
} 
相關問題