2

Making simple extension. But can't force to work this Event.

manifest File:

{
"manifest_version": 2,
"name": "Extantion",
"version": "0.1",

"content_scripts":[
    {
        "matches": ["http://foo.bar/*"],
        "js": ["js/jq.js","js/injection.js"]
    }
]

};

contentScript File:

chrome.pageAction.onClicked.addListener(function() {
console.log("Hello World");
});
AllexF
  • 51
  • 1
  • 1
  • 6
  • 1
    I would suggest that you read the [Chrome extension overview](https://developer.chrome.com/extensions/overview) (and perhaps along with the pages linked from the overview). The [architecture section](https://developer.chrome.com/extensions/overview#arch) has overall architecture information which should help your understanding of how things are generally organized/done. – Makyen Feb 06 '17 at 20:46
  • The documentation also links [sample extensions](https://developer.chrome.com/extensions/samples#search:pageAction). – wOxxOm Feb 06 '17 at 20:56
  • onClicked Fired when a page action icon is clicked. This event **will not fire** if the page action has a popup. manifest.json ` "page_action": { "default_icon": "icons/icon_16.png" },` on background page `chrome.pageAction.onClicked.addListener(function(details){ console.log(details); }) ` **will not fire on content_script** – Oleksii Semeniuk Nov 16 '19 at 15:40
  • Don't forget to set a pageaction for the tab you want to call onClick `chrome.pageAction.show(tabs.tabId, function(d){ console.log(d); });` – Oleksii Semeniuk Nov 17 '19 at 21:47

0 Answers0