简体   繁体   中英

Why doesn't background_page work ? Google Chrome Extension

My manifest :

{
"name" : "gMail Adder ",
"version" : "1.0",
"description" : "Google Chrome Gmail Adder",
"options_page": "options.html",
"background_page": "background.html",
"run_at": "document_start",
"permisions": [
   "tabs", "http://*/*"
],
"content_scripts": [
  {
   "matches": ["*://*.google.mail.com/*", "https://*.google.mail.com/*" ,"http://mail.google.com/*" ,"https://mail.google.com/*", "https://www.google.com/*", "http://www.google.com/*" ],
   "css": ["toggle.css"],
   "js": ["jquery-1.4.4.min.js", "inject.js", "injecter.js"]
  }
],
"browser_action" : {
"default_icon" : "Quest Icon 11.png",
"default_popup": "dialog.html"
}
}

My background.html() :

<html>
<head>

<script type="text/javascript">
alert('test');
chrome.tabs.onCreated.addListener(function() {alert('hello new tab')});
</script>
</head>

<body>
</body>

</html>

When i load the extension the alert('test') works once, but the alert('hello new tab') doesn't seem to work not even once ?

When i click a new tab why doesn't this event trigger the messagebox display ?

UPDATE: If i click on background.html of the extension into the chrome://extension page the console issues the error : " Uncaught Error: You do not have permission to use 'tabs.onCreated'. Be sure to declare in your manifest what permissions you need. " Why is that? All the permissions are right there in the manifest file; it shouldn't issue this error!

You misspelled " permissions ". Everything else is accurate.

SOLVED :

"permisions": [ not
"permissions": [ YES

SORRY for consuming your time for no reason !

PS : Even though my english is bad shouldn't chrome's parser issue a unidentified field error??? Anyways, sorry!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM