首页 > 其他 > 详细

浏览器监听所有xhr请求

时间:2020-10-23 11:59:37      阅读:209      评论:0      收藏:0      [点我收藏+]

如下:

var origOpen = XMLHttpRequest.prototype.open;

XMLHttpRequest.prototype.open = function() {

    this.addEventListener(‘load‘, function() {

        // console.log(this.readyState); //will always be 4 (ajax is completed successfully)
        // console.log(this.responseText); //whatever the response was

        console.log(1)

    })

    origOpen.apply(this, arguments)
}

 

浏览器监听所有xhr请求

原文:https://www.cnblogs.com/kiancyc/p/13863007.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!