I need to block uploading module.js file for site for my convenience. This file simply uploads by tag. In the HTML code, it looks like this:
<script charset="utf-8" id="yui_3_17_2_1_1672056888038_9" src="https://exam.lood.so/lib/javascript.php/1671548766/mod/quiz/module.js" async=""></script>
I'm thinking of doing it in Tampermonkey.
Here I have a script that catches all requests in the xhr/fetch, but I need to abort the file in the "JS" tab.
(function() {
let _open = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function(method, url, async, user, password) {
_open.call(this, method, url, async=async, user=user, password=password)
}
let _send = XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.send = function(data) {
let _onload = this.onprogress;
this.onload = function() {
console.log(this.responseURL)
if (this.responseURL == "my_url") {
console.log("gotcha here!")
}
if (_onload != null) {
_onload.call(this)
}
}
_send.call(this, data)
}
})();
Blocking in devtools is not solution because since each time to block this request, you need to go here.