Chrome extension: how to programmatically inspect extension's background page

瘦欲@ 提交于 2020-01-06 02:40:54

问题


How does one programmatically open the Developer Tools window of a Chrome extension's background page using the Chrome Extensions API?

Essentially, I'm looking to achieve the programmatic equivalent of manually clicking on the "inspect background page" link of a given Chrome extension.


回答1:


Interesting question.

I don't think there is a way to do it; Google's own app, Chrome Apps & Extensions Developer Tool, uses a private API for this:

// Opens the devtools inspect window for the page.
chrome.developerPrivate.inspect({
  extension_id: String(item.id),
  render_process_id: String(view.render_process_id),
  render_view_id: String(view.render_view_id),
  incognito: view.incognito,
});

Obviously, this only works in specially-whitelisted apps and extensions.



来源:https://stackoverflow.com/questions/28064942/chrome-extension-how-to-programmatically-inspect-extensions-background-page

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