Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I programmatically open the devtools from a Google Chrome extension?

I have a chrome extension which hooks into the devtools. Ideally I want a badge that, when clicked, opens up the devtools on the new tab which I created. Is there any way to do this from the background page?

like image 507
Paul C Nichols Avatar asked Jul 23 '11 15:07

Paul C Nichols


People also ask

What are 3 ways to open Developer Tools in Google Chrome?

To open the developer console in Google Chrome, open the Chrome Menu in the upper-right-hand corner of the browser window and select More Tools > Developer Tools. You can also use Option + ⌘ + J (on macOS), or Shift + CTRL + J (on Windows/Linux).

How do I open Developer Tools in JavaScript?

The JavaScript console To access the console in any browser: If the developer tools are already open, click or press the Console tab. If not, Firefox allows you to open the console directly using Ctrl + Shift + K or using the menu command: Menu ➤ Web Developer ➤ Web Console, or Tools ➤ Web Developer ➤ Web Console.

How do I force DevTools to open?

To open the developer console window on Chrome, use the keyboard shortcut Ctrl Shift J (on Windows) or Ctrl Option J (on Mac). Alternatively, you can use the Chrome menu in the browser window, select the option "More Tools," and then select "Developer Tools."

How do I make Chrome Developer Tools open by default?

On opening the developer tools, with the developer tools window in focus, press F1 . This will open a settings page. Check the "Auto-open DevTools for popups". This worked for me.


2 Answers

It seems unlikely that this is possible or will ever become possible,

check this: https://code.google.com/p/chromium/issues/detail?id=112277

which says: "We only allow explicit devtools opening."

like image 110
lokeshsk Avatar answered Sep 21 '22 12:09

lokeshsk


Yes you can (or not) using the experimental APIs chrome.experimental.webInspector.
http://code.google.com/chrome/extensions/experimental.html
You can even change the content and panels of it.
Note that you will not able submit extensions that use experimental APIs.

like image 35
Derek 朕會功夫 Avatar answered Sep 17 '22 12:09

Derek 朕會功夫