0

I want the text of a context menu item to depend on the URL/text of the link it was opened for. Firefox WebExtensions API has menus.onShown exactly for this, but it currently isn't available in Chrome. Is there some workaround?

Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
  • 1
    You can try to detect the active element with a content script. If you store that somewhere when it's an A tag (or IMG?), you can use that to update the context menu item before it's shown. – Smile4ever Mar 24 '18 at 17:40
  • 1
    There are several answers here on StackOverflow that show how to make a dynamic context menu based on clicked element. – wOxxOm Mar 24 '18 at 21:15
  • For example, this one seems to be almost exactly what you're looking for: https://stackoverflow.com/questions/13202896/creating-dynamic-context-menu-in-chrome-extension-is-failing – ethan.roday Mar 27 '18 at 18:04

0 Answers0