如何在上面的菜单栏中显示 chrome 扩展名?

How to display chrome extension in above menubar ?

我创建了 Google chrome 扩展。但这不能显示在菜单栏的上层。下面的代码工作完美但我只想显示我的扩展图标 在 url 标签旁边。有知道的帮帮我吗? 我想启动而不是每次我都必须进入 chrome://extensions/

manifest.json

{
   "manifest_version": 2,
    "name": "Hello World",
    "version": "2.1",
    "minimum_chrome_version": "23",
    "icons": {
      "16": "icon_16.png",
      "128": "icon_128.png"
    },
    "app": {
      "background": {
        "scripts": ["main.js"]
      }
    }
}

MAIN.js

chrome.app.runtime.onLaunched.addListener(function() {
// Center window on screen.
var screenWidth = screen.availWidth;
var screenHeight = screen.availHeight;
var width = 500;
var height = 300;

chrome.app.window.create('index.html', {
  id: "helloWorldID",
  outerBounds: {
    width: width,
    height: height,
    left: Math.round((screenWidth-width)/2),
    top: Math.round((screenHeight-height)/2)
  }
});
});

index.html

<body>
   <h1>Hello, World!</h1>
</body>

你的问题是,你还没有创建 extension

您创建的是 app,如清单中的 "app" 键所示。应用程序无法通过这种方式与浏览器集成,因此您需要进行扩展。

您需要放弃您的代码并按照扩展指南制作一个:Getting Started and Overview. Specifically, the UI element you're asking about is called a Browser Action