如何获取由HTML完成的网络请求列表 [英] How to get list of network requests done by HTML

查看:216
本文介绍了如何获取由HTML完成的网络请求列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能得到使用HTML完成的Javascript的网络请求列表,如chrome devtools所示。



例如:



这是Google的devtools。 COM。我想要使​​用javascript在列表中获取所有这些请求。这可能吗?如果是的话,怎么样?

解决方案

有些浏览器已经实现了尚未标准资源计时API ,您可以在其中收集这些信息。

某些浏览器可能提供一些此信息到浏览器扩展作为他们开发者工具支持的一部分,但是这需要安装一个自定义的扩展,而不是从一个普通的网页上完成。



非常具体的操作,你控制调用代码或者你知道调用代码,可以测试一些事情。例如,如果你知道所有的ajax调用都经过了一个特定的函数,那么你可以挂接那个函数,它是完成处理程序并监视所有的ajax调用。


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

For example:

This is the devtools for google.com. I want to, using javascript get all these request in a list. is this possible? if yes how?

解决方案

Some browsers have implemented a version of the not-yet-standard, Resource Timing API where you can collect some of this information.

Some browsers may have some of this info available to browser extensions as part of their developer tools support, but that would require the installation of a custom extension, not something that could be done from a regular web page.

For very specific operations where you control the calling code or you know the calling code, it is possible to instrument some things. For example, if you know that all ajax calls go through one particular function, you can hook that function and it's completion handlers and monitor all ajax calls.

这篇关于如何获取由HTML完成的网络请求列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆