Created
March 13, 2024 16:26
-
-
Save LuxXx/d9534122fe7c1275a1e90e129104777b to your computer and use it in GitHub Desktop.
detour XMLHttpRequest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
// Preserve the original 'open' function | |
var originalOpen = window.XMLHttpRequest.prototype.open; | |
window.XMLHttpRequest.prototype.open = function () { | |
arguments[1] = arguments[1].replace( | |
"https://example.com/", | |
"https://detour.com/" | |
); | |
console.log("XHR intercepted:", arguments); | |
// Call the original 'open' | |
return originalOpen.apply(this, arguments); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment