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