无法使用Chrome实验性Devtools API [英] Unable to use Chrome Experimental Devtools API

查看:336
本文介绍了无法使用Chrome实验性Devtools API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Chrome实验性开发工具API。



我试着用Chrome浏览器运行:--enable-experimental-extension-apis : http://developer.chrome.com/extensions/experimental.html 并启用了标记设置中的试验扩展API。



当我在Chrome(或Canary)中打开控制台时,出现以下内容:


  • chrome.devtools:undefined
  • chrome.experimental:undefined


我正在运行Chrome 21.0.1180.77 beta-m。我也尝试过金丝雀。



我缺少什么?

解决方案

<正如这里所解释的: http://developer.chrome.com/extensions/devtools.html中,chrome.devtools API仅在您的devtools HTML页面中可用。



首先,您需要创建一个HTML文件,然后将其添加到您的扩展的清单中devtools_page键。当您将扩展程序加载到Chrome并打开DevTools时,您应该会看到您的新标签。



在该标签中,chrome.devtools是唯一可用的地方。



chrome.experimental是不同的,并且可以在所有背景页面和内容脚本中使用。


I'm trying to use the Chrome Experimental Devtools API.

I've tried running Chrome with: --enable-experimental-extension-apis as suggested here: http://developer.chrome.com/extensions/experimental.html and enabled the "Experimental Extension APIs" in the flags settings.

When I open the Console in Chrome (or Canary), I get the following:

  • chrome.devtools: undefined
  • chrome.experimental: undefined

I'm running Chrome 21.0.1180.77 beta-m. I've also tried Canary.

What am I missing?

解决方案

As explained here: http://developer.chrome.com/extensions/devtools.html, the chrome.devtools APIs are only available in your devtools HTML page.

First, you need to create an HTML file and then add it to your extension's manifest under the "devtools_page" key. When you load your extension into Chrome and open the DevTools, you should see your new tab.

In that tab is the only place chrome.devtools will work.

chrome.experimental is different and will be available in all of your background pages and content scripts.

这篇关于无法使用Chrome实验性Devtools API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆