Catch the XMLHttpRequest in plain JavaScript

When coding Chrome extensions, sometimes I need to catch the event when JavaScript application starts a XMLHttpRequest (XHR) and finishes. Because the injected script into web page context do not modify the original application, this is hard to do, because pure XHR does not trigger global events. Some libraries, for example jQuery, do trigger global events ajaxStart and ajaxStop, and even offers global ajax events… Continue reading