将下拉菜单添加到Chrome扩展程序图标 [英] Adding drop-down menu to chrome extension icon

查看:222
本文介绍了将下拉菜单添加到Chrome扩展程序图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以关联一个 popup.html 来点击扩展程序按钮。不过,我希望它是一个菜单,就像点击Chrome自己的自定义并控制Google Chrome按钮(位于扩展图标右侧)弹出的菜单一样。我试图谷歌,但似乎没有人谈论这一点。我是否缺少关于Chrome扩展开发的常识?

解决方案

p>

您可以通过 chrome.browserAction.onClicked 注册点击,但不显示用户界面,或者打开一个HTML页面弹出。您可以将它设置为菜单样式,但它不会像本地下拉菜单。



请注意,您可以右键单击扩展按钮, 但你到那里的菜单是固定的。我很久以前就提交了功能请求,但它没有起飞。现在有一个 contextMenus 上下文browser_action p>

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 "Customize and control Google Chrome" button (located to the right of your extension icons). I tried to Google it but no one seemed to be talking about that. Am I missing any common sense about Chrome extension development?

解决方案

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.

这篇关于将下拉菜单添加到Chrome扩展程序图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆