开发者

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

开发者 https://www.devze.com 2023-03-06 20:34 出处:网络
im trying to make a chrome extension and i cant get my code to run. this is the manifest { \"name\": \"My First Extension\",

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

精彩评论

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