How to get list of network requests done by HTML

后端 未结 5 951
情话喂你
情话喂你 2020-11-27 16:46

How can i get the list of network requests using Javascript done by the HTML, as seen in the chrome devtools.

For example:

5条回答
  •  Happy的楠姐
    2020-11-27 17:37

    As I understand it, you can consult the list of requests via JavaScript. It is? "I do not know how."

    But one solution that can help is this ...

    You intercept all requisitions with the code below. If your JavaScript runs very early in loading the page you will be able to get most of the requests from the list.

    See how cool this article.

    XMLHttpRequest.prototype.realSend = XMLHttpRequest.prototype.send;
    XMLHttpRequest.prototype.send = function(value) {
        this.addEventListener("progress", function(){
            console.log("Loading. Here you can intercept...");
        }, false);
        this.realSend(value);
    };
    

提交回复
热议问题