我正在尝试使用新的 chrome 通知,只是尝试一个基本的通知来工作,但我不断得到
未捕获的类型错误:无法调用未定义的方法“创建”
我认为这是清单,但我不确定我做错了什么,有人有什么想法吗?
提前致谢
Javascript
var id= 0;
var opt={
type:"basic",
title:"Hello",
message:"world",
iconUrl:"Google.png"
}
function creationCallback(id) {
console.log("Succesfully created " + id + " notification");
}
function createnot()
{
chrome.notifications.create(id, opt, creationCallback);
id++;
}
显现
{
"name": "Notification API Sample",
"description": "Tests the notification API",
"manifest_version" : 2,
"version" : "0.1",
"permissions" : [
"notifications"
]
}
HTML
<html>
<head>
<script type="text/javascript" src="note.js"></script>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<input type="button" value="meh" onclick="createnot()"/>
<footer>
</footer>
</body>
</html>