nope
nope

Reputation: 1078

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

 <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?

Upvotes: 2

Views: 1859

Answers (1)

serg
serg

Reputation: 111265

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

Upvotes: 3

Related Questions