s

capture http requests using XMLHttpRequest.prototype.open edit button Edit

author
Murugan Andezuthu Dharmaratnam | calendar 30 August 2022 | 816

capture http requests using XMLHttpRequest.prototype.open

Sample Code

 var rawOpen = XMLHttpRequest.prototype.open;

XMLHttpRequest.prototype.open = function(m,url) {
	if (!this._hooked) {
		this._hooked = true;
		       if(url.includes(".ts"))
               {
                   console.log(url);
               }
        
	}
	rawOpen.apply(this, arguments);
}



XMLHttpRequest.prototype.open = rawOpen;