Google chrome extension Chrome扩展:上下文菜单复选框在windows Chrome浏览器版本23.0.1271.91中不可见

Google chrome extension Chrome扩展:上下文菜单复选框在windows Chrome浏览器版本23.0.1271.91中不可见,google-chrome-extension,Google Chrome Extension,我正在开发chrome扩展。 创建了带有上下文菜单选项的复选框,它在Ubuntu(O/s)的Chrome浏览器(21.0.1180.15 beta版)中运行良好。 但该复选框在Windows XP Chrome浏览器(版本23.0.1271.91)中不可见 给你同样的建议 我使用的是同一个版本,它可以正常工作 您是否已检查上下文菜单的权限,如图所示 manifest.json { "name": "Context Menu Demo", "description": "This giv

我正在开发chrome扩展。 创建了带有上下文菜单选项的复选框,它在Ubuntu(O/s)的Chrome浏览器(21.0.1180.15 beta版)中运行良好。 但该复选框在Windows XP Chrome浏览器(版本23.0.1271.91)中不可见


给你同样的建议

我使用的是同一个版本,它可以正常工作

您是否已检查上下文菜单的权限,如图所示

manifest.json

{
  "name": "Context Menu Demo",
  "description": "This gives demo of context menu features",
  "version": "1",
  "permissions": ["contextMenus"],
  "background": {
    "scripts": ["sample.js"]
  },
  "manifest_version": 2,
  "icons":{"16":"screen.png","48":"screen.png","128":"screen.png"}
}
您是否在
background.js
中包含了代码

var contextMenuCallback = function(info, tab) {
  console.log(info);
  console.log(tab);
  // we can do other stuff here.
}

var first_params = {
  "id": "first_id",
  "title": "First",
  "type": "checkbox",
  "checked": true,
  "onclick": contextMenuCallback
};
var second_params = {
 "id": "second_id",
 "title": "Second",
 "type": "checkbox",
 "checked": true,
 "onclick": contextMenuCallback
};  
chrome.contextMenus.create(first_params);
chrome.contextMenus.create(second_params);

请尝试此代码并向我们发送屏幕截图,以获取您期望的输出和缺少的输出?

我正在使用checked=false更新上下文菜单,使用以下代码:chrome.contextMenus.update(“first_id”,“checked”:false});现在得到了解决方案,需要这样编码:chrome.contextMenus.update(“first_id”,“type”:“checkbox”,“checked”:false});
var contextMenuCallback = function(info, tab) {
  console.log(info);
  console.log(tab);
  // we can do other stuff here.
}

var first_params = {
  "id": "first_id",
  "title": "First",
  "type": "checkbox",
  "checked": true,
  "onclick": contextMenuCallback
};
var second_params = {
 "id": "second_id",
 "title": "Second",
 "type": "checkbox",
 "checked": true,
 "onclick": contextMenuCallback
};  
chrome.contextMenus.create(first_params);
chrome.contextMenus.create(second_params);