开发者

why am i getting Cannot call method 'addListener' of undefined?

im trying to make a chrome extension and i cant get my code to run. this is the manifest

  {
  "name": "My First Extension",
   "version": "1.0",
   "description": "The first extension that I made.",
 "browser_action": {
 "default_icon": "icon.png"
 },
 "background_page": "background.html",
 "permissions": [
 "*://*",
"tabs"
]
}

and this is my background.html

开发者_StackOverflow中文版
 <body>
<script>
chrome.tabs.OnCreated.addListener(function(tab){
    alert("fooooooo");

});
</script>
</body>

and in the chrome debugger i get Uncaught TypeError: Cannot call method 'addListener' of undefined.

ive set the permissions correctly i think, but now i really dont know how to fix this. can anyone help?


Instead of OnCreated it should be onCreated. JavaScript is case sensitive.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜