我该如何检查网站是否正在加载,例如jquery或从imgur下载图像?我可以在Firefox / Chrome中检查此流量,但我希望以编程方式进行检查,最好是在bash中。
我知道我可以使用curl获取内容,但有时某些外部内容会加载各种东西,我想检查哪些内容/脚本/资源已经被加载。
类似于以下图片:
我知道我可以使用curl获取内容,但有时某些外部内容会加载各种东西,我想检查哪些内容/脚本/资源已经被加载。
类似于以下图片:
![Like this](https://istack.dev59.com/v6MGE.webp)
对于像您示例中的jQuery等外部库,您可以检查仅存在于该库中的全局变量的存在:
if (jQuery) {
// this resource has been loaded
}
或者
if (someLibraryVariable === 'undefined') {
// if this is undefined, this resource using this variable is not loaded on the page
}