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 !
1 Answer 1
It worked try:
"browser_action": { "default_title": "My extension", "default_icon": "icon.png" },
instead of:
"browser_action": { "name": "My extension", "icons": ["icon.png"] },
Brock Adams
94k23 gold badges242 silver badges312 bronze badges
answered Nov 15, 2012 at 10:44
Sudarshan
18.6k7 gold badges56 silver badges62 bronze badges
Sign up to request clarification or add additional context in comments.
3 Comments
Sudarshan
It worked try "browser_action": { "default_title": "My extension", "default_icon": "icon.png" }, instead of "browser_action": { "name": "My extension", "icons": ["icon.png"] },
Morgan
I might be missing someting here... That doesn't work either. Stil no "this_is_my_own_div" in the source page of amazon.com for example...
Morgan
Hmm, apparently, it's working on my colleague's Mac. I run Version 23.0.1271.64 m on Windows 8, maybe this is why... Strange though...
Explore related questions
See similar questions with these tags.
lang-js