有什么方法可以使用用户创建的扩展在 chrome 浏览器中打开 devtool 面板

Is there any way to open devtool panel in chrome browser using user created extension

在许多地方它显示使用实验性 api,但它对我不起作用。

manifest.json:-

"permissions":[
        "tabs",
        "experimental",
        "storage" ,
        "http://*/*",
        "https://*/*"
        ]

devtool.js :-

chrome.experimental.devtools.panels.create("xyz",
                              "icon.png",
                              "panel.html",
                              function(panel) {  
  });

您使用的是 chrome 浏览器的金丝雀版还是开发版?

来自文档:

  1. Make sure you're using either Canary (which you can use at the same time as other Chrome channels) or the Dev channel. Although the experimental APIs might work in other versions, we need your feedback on the latest incarnation of the APIs, which you can find in Canary and on the Dev channel.

您还需要在浏览器中启用实验性 API

  1. Enable the experimental API in your browser. You can do this in either of two ways: Go to chrome://flags, find "Experimental Extension APIs", click its "Enable" link, and restart Chrome. From now on, unless you return to that page and disable experimental APIs, you'll be able to run extensions and apps that use experimental APIs. Specify the --enable-experimental-extension-apis flag each time you launch the browser. On Windows, you can do this by modifying the properties of the shortcut that you use to launch Google Chrome. For example: path_to_chrome.exe --enable-experimental-extension-apis

https://developer.chrome.com/extensions/experimental

您可能也想阅读这篇文章。 Can I programmatically open the devtools from a Google Chrome extension?