My extension is simply performing actions on pages based on user clicks; it works fine on all websites except for Gmail.
Here’s my manifest file:
{
"name": "My Extension",
"version": "2.0",
"description": "description.",
"permissions": [
"tabs"
],
"icons": {
"16" : "images/icon-16.png",
"48" : "images/icon-48.png",
"128" : "images/icon-128.png"
},
"background_page": "background.html",
"options_page": "Options.html",
"content_scripts": [
{
"matches": ["<all_urls>"],
"css": ["css/style.css"],
"js": ["inject.js"]
}
]
}
When I click on a web page, my inject.js normally fires an alert() — it handles onclick events. But, on Gmail pages, it does not catch the click event.
Gmail is composed of frames. By default, content scripts are only injected at the top-level frame. Add
"all_frames":trueto the manifest, so that the content script is also injected in the frames.