Is there a way to control the order that my Chrome extension's context menu item appears in?
It probably can't appear above any of the Chrome's built in context menu items (like "Open link in new tab", etc.), but maybe there is a way to control where it appears among other extensions' context menu entries?
Probably not, because in all likelihood all makers of extensions want their's to be above all others, but just in case I'm wrong.. :)
The context menu entries are ordered alphabetically. This means that if you name your context entry something like AAWhatever
, the likelihood of your entry being at the top is pretty high. I know of no other way to control the position of your entry using only your extension.
When you create multiple context menus(items) in your extension, and their contexts are set, such that they appear simultaneously, then the order in which they appear in the menu is dependent on the order in which the items(menus) are created.
Therefore, you can control order, by being mindful of not only the order you create them in, but then setting the contexts
parameter to hide them upon creation, then display them when needed using chrome.contextMenus.update()
with a different contexts
value... this will give the appearance of inserting menus and/or moving them around if done properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With