window.XMLHttpRequest.prototype.open 可以监听 XMLHttpRequest 。但不能监听fetch请求。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- jquery --> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> </head> <body> </body> <script> var _open = window.XMLHttpRequest.prototype.open var _send = window.XMLHttpRequest.prototype.send // https://github.com/Tencent/vConsole/blob/dev/src/network/network.js#L271 window.XMLHttpRequest.prototype.open = function() { console.log(20181117200649, arguments) return _open.apply(this, arguments) } // fetch("http://localhost/fuck.php").then(response => { // // console.log(20181117201438, response.json()) // return response.json() // }).then(data=>{ // console.log(20181117201450, data) // }) $.ajax({ url: "http://localhost/fuck.php", success: function (data) { console.log(20181117133228, data); } }) </script> </html>
td.linenos { background-color: #f0f0f0; padding-right: 10px }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px }
pre { line-height: 125% }
.hll { background-color: #49483e }
.c { color: #75715e }
.err { color: #960050; background-color: #1e0010 }
.k { color: #66d9ef }
.l { color: #ae81ff }
.n { color: #f8f8f2 }
.o { color: #f92672 }
.p { color: #f8f8f2 }
.ch { color: #75715e }
.cm { color: #75715e }
.cp { color: #75715e }
.c1 { color: #75715e }
.cs { color: #75715e }
.gd { color: #f92672 }
.ge { font-style: italic }
.gi { color: #a6e22e }
.gs { font-weight: bold }
.gu { color: #75715e }
.kc { color: #66d9ef }
.kd { color: #66d9ef }
.kn { color: #f92672 }
.kp { color: #66d9ef }
.kr { color: #66d9ef }
.kt { color: #66d9ef }
.ld { color: #e6db74 }
.m { color: #ae81ff }
.s { color: #e6db74 }
.na { color: #a6e22e }
.nb { color: #f8f8f2 }
.nc { color: #a6e22e }
.no { color: #66d9ef }
.nd { color: #a6e22e }
.ni { color: #f8f8f2 }
.ne { color: #a6e22e }
.nf { color: #a6e22e }
.nl { color: #f8f8f2 }
.nn { color: #f8f8f2 }
.nx { color: #a6e22e }
.py { color: #f8f8f2 }
.nt { color: #f92672 }
.nv { color: #f8f8f2 }
.ow { color: #f92672 }
.w { color: #f8f8f2 }
.mb { color: #ae81ff }
.mf { color: #ae81ff }
.mh { color: #ae81ff }
.mi { color: #ae81ff }
.mo { color: #ae81ff }
.sb { color: #e6db74 }
.sc { color: #e6db74 }
.sd { color: #e6db74 }
.s2 { color: #e6db74 }
.se { color: #ae81ff }
.sh { color: #e6db74 }
.si { color: #e6db74 }
.sx { color: #e6db74 }
.sr { color: #e6db74 }
.s1 { color: #e6db74 }
.ss { color: #e6db74 }
.bp { color: #f8f8f2 }
.vc { color: #f8f8f2 }
.vg { color: #f8f8f2 }
.vi { color: #f8f8f2 }
.il { color: #ae81ff }
原文地址:https://www.cnblogs.com/CyLee/p/9977143.html