Reputation: 95
I'm stuck with what seems to be really simple. I'm trying to inject a div of my own in every page the user visited, in a google chrome extention. I looked at examples on the web, but nothing seems to be working with me :s
Here's my manifest.json
{
"name": "My extension",
"version": "1.0",
"permissions": [
"http://*/*", "tabs", "https://*/*"
],
"browser_action": {
"default_title": "My extension",
"default_icon": "icon.png"
},
"manifest_version": 2,
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"js": ["test.js"],
"run_at": "document_end",
"all_frames": true
}
]
}
And my test.js
var newdiv = document.createElement('div');
newdiv.setAttribute('id','this_is_my_own_div');
document.body.appendChild(newdiv);
But I get nothing in source codes... My div's not created. How can I check if my test.js is running ? I can't understand why it is working with others and not with me :s Any help appreciate !
Upvotes: 0
Views: 251
Reputation: 18524
It worked try:
"browser_action": { "default_title": "My extension", "default_icon": "icon.png" },
instead of:
"browser_action": { "name": "My extension", "icons": ["icon.png"] },
Upvotes: 2