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.
精彩评论