Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I open the Google Chrome Console from JavaScript? [duplicate]

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.

like image 850
Claudiu Murariu Avatar asked Jan 01 '11 18:01

Claudiu Murariu


People also ask

How do I open the JavaScript console in Chrome?

Press Command+Option+J (Mac) or Control+Shift+J (Windows, Linux, ChromeOS) to open the Console, right here on this very page.


2 Answers

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.

like image 194
Piskvor left the building Avatar answered Oct 13 '22 16:10

Piskvor left the building


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

like image 27
loislo Avatar answered Oct 13 '22 15:10

loislo