0

Hı I made a simple chrome extension. But what ı need is that when user left click the extension icon it will show right click menu. I know some extension does that but ı dont know how to do.

chrome.browserAction.onClicked.addListener(buttonClicked)
function buttonClicked(tab) {
//Force to right click

}
Oğuz Kurukaya
  • 146
  • 1
  • 3
  • 14
  • here's a link that will be useful: [trigger right click with pure javascript](https://stackoverflow.com/questions/7914684/trigger-right-click-using-pure-javascript) – horrible Jul 16 '20 at 21:16

2 Answers2

0

You need to disable the popup for the current tab.

  • If you use page_action the popup will be disabled by default unless you explicitly enable it on this tab.

  • If you use browser_action, you can disable the popup explicitly:

    chrome.tabs.query({currentWindow: true, active: true}, tabs =>
      chrome.browserAction.disable(tabs[0].id);
    });
    
wOxxOm
  • 65,848
  • 11
  • 132
  • 136
-1

This is currently not possible, but someone made a library that does a neat trick to make your own mouse that you can control and do stuff with. You can probably use that idea. I checked it by making an tag on the h2 header and it actually redirected me to the link. It does have some fullbacks. For example, the user can press the sec key and stop it from working. That can be fixed by automatically controlling the mouse again but then there are the popups that start appearing which is another fallback. Still, it works. It might be a bit of hard work to set up. I created an issue in the Chromium Bug Tracker. Here is the library: https://github.com/octalmage/mousecontrol. Happy hacking!

Saiansh Singh
  • 583
  • 5
  • 16