How to restirict chrome to add only one contextmenu?

寵の児 提交于 2019-12-13 07:25:56

问题


I have created context menu & its child menus for selection of text using chrome.contextMenus.create but it creates multiple menus & sub-menus while testing. Can you tell me what is the prblem.

I am using code to create menus :

var contexts=["selection"];
var context = contexts[0];
var title = "Parent";
var id = chrome.contextMenus.create({"title": title, "contexts":[context]},function (){

var child1 = chrome.contextMenus.create({"title": "child1", "contexts":[context], "parentId": id, "onclick": RecogniseNumber});

var child2 = chrome.contextMenus.create({"title": "child2", "contexts":[context], "parentId": id, "onclick": UnRecogniseNumber});

var child3 = chrome.contextMenus.create({"title": "child3", "contexts":[context], "parentId": id, "onclick": CallNumber}); });

来源:https://stackoverflow.com/questions/18378027/how-to-restirict-chrome-to-add-only-one-contextmenu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!