Reputation: 6325
I am creating a simple Chrome extension that blocks the "Google" logo image on the Google homepage using a content script. I followed the directions on the content-script page, but it still does not seem to be working. Can anyone spot what I'm doing wrong?
manifest.json:
{
"manifest_version": 2,
"name": "Google Logo Blocker",
"description": "This extension blocks the Google logo image.",
"version": "1.0",
"content_scripts": [
{
"matches": ["http://www.google.com/"],
"css": ["blocker.css"]
}
],
"browser_action": {
"default_icon": "icon.png"
}
}
blocker.css:
img {
display: none !important;
}
Upvotes: 2
Views: 941
Reputation: 93443
Your code works for me. You are using straight USA Google, not an international version, right?
Just in case, change your matches
to:
"matches": ["http://*.google.com/", "https://*.google.com/"],
And target the logo more directly. This will work in most cases:
#hplogo {
display: none !important;
}
For full-on, international Google support, change the content_scripts
portion of your manifest to:
"content_scripts": [ {
"matches": ["http://*/*", "https://*/*"],
"include_globs": ["http://*.google.*/*", "https://*.google.*/*"],
"css": ["blocker.css"]
} ],
Optionally also using exclude_matches
and/or exclude_globs
as desired.
If it still doesn't work, state the usual:
Upvotes: 3
Reputation: 18524
It is <img>
tag in modern version and is a <div>
tag with background image for international version. Regardless, of the differences they bear same id = hplogo
, so this can work for you.
Use
#hplogo{
display:none !important;
}
it will remove google Logo.
Upvotes: 1