Automatically open Chrome Dev Tools with target='_blank' link?
Asked Answered
R

4

7

When you click a target='_blank' link, it naturally opens a new tab in Google Chrome. For particular sites, I need to use the Chrome Developer Tools to examine the http requests for any new tabs that are opened.

Whenever you have Chrome Dev Tools open on your current page and then click a link that opens a new tab, Chrome Dev Tools are not opened on the new page by default. Opening Chrome Dev Tools at this point is too late because the tools do not capture the http requests for the page.

Also, in many cases, these new tabs go through a series of redirects before reaching the final page, so I cannot simply reload the page after opening Chrome Dev Tools.

The only workaround I can think of is, in the case that the site I'm working on is on a local development server, I can temporarily change the link from target='_blank' to target='_self', but this is unrealistic for a site with thousands of links or for a site that I have no control over the code.

Is it possible to set Chrome Dev Tools to automatically open with every new tab (opened either manually or via target='_blank'?

Rauscher answered 17/9, 2012 at 14:57 Comment(1)
could be a good suggestion for google ui experiences in dev tools ;)Brandybrandyn
M
3

It's possible to auto open devtools for all the new tabs instead of just target = _blank. When launching google chrome, pass the flag --auto-open-devtools-for-tabs. It enables launching of devtools for all the windows created automatically.

For linux

google-chrome --auto-open-devtools-for-tabs

For Mac

open -a "Google Chrome" --args --auto-open-devtools-for-tabs

Margetts answered 23/6, 2018 at 13:8 Comment(1)
This does not work for me: Chromium 86.0.4215.0 64bit.Chemarin
H
10

I'm not sure as of which Chrome version this changed, but if you click on the Settings wheel on dev tools:

enter image description here

You'll see a Global section with a checkmark for "Auto-Open DevTools for popups", which works for opening target="_blank" links with a devtools window:

enter image description here

Hydropic answered 16/6, 2020 at 0:41 Comment(0)
M
3

It's possible to auto open devtools for all the new tabs instead of just target = _blank. When launching google chrome, pass the flag --auto-open-devtools-for-tabs. It enables launching of devtools for all the windows created automatically.

For linux

google-chrome --auto-open-devtools-for-tabs

For Mac

open -a "Google Chrome" --args --auto-open-devtools-for-tabs

Margetts answered 23/6, 2018 at 13:8 Comment(1)
This does not work for me: Chromium 86.0.4215.0 64bit.Chemarin
D
0

You can use Charles Proxy or any other HTTP debugging tool working outside the browser to help you investigate the problem.

Delubrum answered 26/4 at 19:33 Comment(0)
L
-4

You can only open DevTools window via UI action or keyboard shortcut. There is no way to do this automatically.

Loewi answered 18/9, 2012 at 6:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.