Chrome Rich Notifications未显示

时间:2014-03-03 20:41:05

标签: javascript google-chrome google-chrome-extension

好的,在我的Chrome扩展程序清单中,我已经允许通知,现在我正在使用webkitNotifications,虽然我说Rich Notifications并且更喜欢它们,所以我出去找出如何写它们就像需要哪些参数,所以我在控制台中测试但它没有出现?

chrome.notifications.create('report',{
  type:'basic',
  title:'hello world',
  message:'Dance with me please',
  expandedMessage:'Hello thanks for using our app',
  priority:1,
  buttons:[{title:'Follow URL'},{title:'Remind me Later'}],
  isClickable:true
},function(){});

然而,我不确定这是否是webkitNotifications需要一个show()函数来实际显示所需的全部内容。任何想法的家伙?

1 个答案:

答案 0 :(得分:1)

iconUrl方法需要

createhttp://developer.chrome.com/extensions/notifications#type-NotificationOptions

chrome.notifications.create('report',{
  type:'basic',
  title:'hello world',
  iconUrl: 'yourIconUrl',
  message:'Dance with me please',
  expandedMessage:'Hello thanks for using our app',
  priority:1,
  buttons:[{title:'Follow URL'},{title:'Remind me Later'}],
  isClickable:true
},function(){});