Chrome Dev Tools: How to trace network for a link that opens a new tab?

后端 未结 10 2062
我在风中等你
我在风中等你 2020-12-04 05:23

I want to trace the network activity that happens when I click on a link. The problem is that the link opens a new tab, and apparently the Dev Tools works per tab it was ope

10条回答
  •  死守一世寂寞
    2020-12-04 05:43

    Check out chrome://net-internals/#events (or chrome://net-export in the latest version of Chrome) for a detailed overview of all network events happening in your browser.


    Other possible solution, depending on your specific problem, may be to enable 'Preserve log' on the 'Network' tab:

    DevTools > Network > Preserve log

    and force all links to open in the same tab by executing the following code in the console:

    [].forEach.call(document.querySelectorAll('a'),
        function(link){
            if(link.attributes.target) {
                link.attributes.target.value = '_self';
            }
        });
    
    window.open = function(url) {
        location.href = url;
    };
    

提交回复
热议问题