Adding drop-down menu to chrome extension icon

后端 未结 2 748
伪装坚强ぢ
伪装坚强ぢ 2021-02-16 00:10

I know that I can associate a popup.html to clicks on the extension button. However, I want it to be a menu, like the one popping up after clicking on Chrome\'s own \"C

2条回答
  •  爱一瞬间的悲伤
    2021-02-16 00:20

    You can't.

    You can either register a click via chrome.browserAction.onClicked but show no UI, or open an HTML page in a popup. You can style it to look like a menu, but it will still not be like a native drop-down menu.

    Note that you can right-click the extension button, but the menu you get there is fixed. I submitted a feature request a long time ago regarding that, but it never took off. There is a contextMenus context "browser_action" now that achieves this.

提交回复
热议问题