28

The question might sound weird but I kind of need this to happen. The alternative would be to ask people to press Ctrl+Shift+i but I would prefer to avoid that and just provide a link.

The link would show up in a Chrome Extension so I'm only interested for Google Chrome.

Ian
  • 50,146
  • 13
  • 101
  • 111
Claudiu Murariu
  • 289
  • 1
  • 3
  • 3
  • 4
    [Can I programmatically open the devtools from a Google Chrome extension?](http://stackoverflow.com/questions/6801577/can-i-programmatically-open-the-devtools-from-a-google-chrome-extension?rq=1) – jantimon Mar 07 '13 at 14:21

3 Answers3

11

It is not clear why you need to provide such link. DevTools is not a tool for the end user. If you don't like keyboard shortcuts, then there is a page chrome://inspect/ which has the list of pages and extensions, and each entry has a link that opens devtools.

Also, you may use remote debugging page which opens devtools in a page. https://developers.google.com/chrome-developer-tools/docs/remote-debugging

katspaugh
  • 17,449
  • 11
  • 66
  • 103
loislo
  • 14,025
  • 1
  • 28
  • 24
  • chrome://inspect/ is using `chrome.send('inspect',[String(data.processId), String(data.routeId)]);` maybe this could lead to a solution – jantimon Mar 08 '13 at 15:01
  • http://blog.poweredbytoast.com/googles-undocumented-quotchromesendquot-command – jantimon Mar 08 '13 at 15:09
  • 1
    Well, I see this request similar to `debugger;`, but something that opens console instead of debugger tool. A use case I have is, for coding tools like codepen, openprocessing, to show errors and links for users to check their console: "Hey the code you wrote has a bug, see it in console. Open Console" etc. – msawired Aug 08 '19 at 16:56
11

Sorry, not likely to happen (except as a security hole). Your in-page JavaScript is deliberately sandboxed and limited - it can interact with the page, and with the network through AJAX, but it cannot and should not interact with other things that happen in your computer - including the browser.

Piskvor left the building
  • 91,498
  • 46
  • 177
  • 222
  • 6
    I believe Claudiu is referring to Javascript as executed by the Chrome extension, not by any particular page's environment. Extensions have both richer API and bigger permissions (according to the plug-in's manifest file), IIRC. – Kos Jan 01 '11 at 18:42
  • Interesting since you would only open, not edit it. And someone could just fake the input anyways.. – LuckyLuke Skywalker Apr 11 '23 at 15:27
6

Have you tried Firebug Lite. It is an in-browser tool similar to that found in Chrome.

http://getfirebug.com/firebuglite

It will give you most of the capabilities you are looking for (most likely), and will allow you to programmatically enable it and destroy it.

What do you think?

Khalid Abuhakmeh
  • 10,709
  • 10
  • 52
  • 75