admin管理员组文章数量:1427586
Here is my code. I'm not sure whether this is supposed to work.
$('#save').bind('click', function(e){
var opt = {
type: "basic",
title: "Deploy",
message: "It worked!"
};
chrome.notifications.create("", opt, function(id) {});
});
I have my permissions set up to use notifications, so I think that isn't the problem.
Here is my code. I'm not sure whether this is supposed to work.
$('#save').bind('click', function(e){
var opt = {
type: "basic",
title: "Deploy",
message: "It worked!"
};
chrome.notifications.create("", opt, function(id) {});
});
I have my permissions set up to use notifications, so I think that isn't the problem.
Share Improve this question edited Apr 5, 2014 at 15:42 sowbug 4,68223 silver badges29 bronze badges asked Apr 4, 2014 at 18:21 BlynnBlynn 1,4217 gold badges27 silver badges49 bronze badges 3-
There is a syntax error in there:
function(id) {);}
should be justfunction(id) {}
– Xan Commented Apr 4, 2014 at 18:23 - I just updated that bug, but still no luck – Blynn Commented Apr 4, 2014 at 18:26
- Please update the question to confirm that you're using Linux (which doesn't have support yet for Rich Notifications). Also see github./GoogleChrome/chrome-app-samples/tree/master/… if you don't understand the documentation. – sowbug Commented Apr 5, 2014 at 15:43
1 Answer
Reset to default 7Note that the documentation lists iconUrl
as a required option for opt
in chrome.notifications.create
.
So suppose you add a picture icon.png
to the root of your extension. Then your code can be modified like that:
var opt = {
type: "basic",
title: "Deploy",
message: "It worked!",
iconUrl: "icon.png"
};
chrome.notifications.create("", opt, function(id) {
if(chrome.runtime.lastError) {
console.error(chrome.runtime.lastError.message);
}
});
This should work, and in case there is any problem with the notification you'll get informed in the console.
本文标签: javascriptChrome Notification in a packaged app quotchromenotificationscreatequotStack Overflow
版权声明:本文标题:javascript - Chrome Notification in a packaged app. "chrome.notifications.create" - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745501496a2661052.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论