I've been looking at the jQuery code but is kinda huge. Would this be an easy task? Any idea how to do it?
The reason I want to do this is because I want to use it not for a web page but for a C# application that needs to know when there is ajax activity going on in a WebBrowser. So I would inject my javascript code in any web page I want to detect ajax activi开发者_运维技巧ty, instead of injecting the whole jQuery which might be already present and cause a conflict.
jQuery's ajaxStart
doesn't fire for arbitrary XMLHttpRequest
events, only for those coming from within jQuery.
You can trivially test* this by spinning up your own XMLHttpRequest
after registering an ajaxStart
handler.
So, technically, its easy to emulate: just route all your ajax traffic through a common method.
I doubt that's going to help you much since you won't actually capture all ajax requests, just the ones you kick off (and thus already know about, by definition).
*I did, since I wasn't sure.
精彩评论