chrome extension context menus, how to display a menu item only when there is no selection?

前端 未结 2 905
天命终不由人
天命终不由人 2020-12-11 04:25

What I want to do is:

if the user does not select anything, display menu item A;

if the user selects something, display menu item B.

2条回答
  •  轮回少年
    2020-12-11 04:52

    Perhaps this was a bug or the functionality was different back when the OP originally asked the question (jun 17, 2011); but today, the OP's code works exactly as expected by simply using contexts parameters in her chrome.contextMenus.create() calls, exactly as she has it written.

提交回复
热议问题