谷歌Chrome浏览器webkit通知撤消权限?打开/关闭?
问题描述:
我有webkit通知工作完美,但我想让用户选择切换它们,如果他们发现他们讨厌。谷歌Chrome浏览器webkit通知撤消权限?打开/关闭?
我已经搜索了API,但找不到任何与撤消权限有关的事情。
基本的东西,看起来像下面...
<input type="button" onclick="window.webkitNotifications.requestPermission();" value="Yes" />
<input type="button" onclick="window.webkitNotifications.revokePermission();" value="No" />
答
不能撤销通知的权限,他们只能使用每页面的基础上镀铬的配置 设置»高级设置»保密设置,撤销»内容设置»通知。
如果你不想显示它们,你将需要跟踪用户的选择,而不是创建通知,而不是撤销权限。
这里是铬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);
}