I have seen a proxy website with code similar to this, but there code is obfuscated.
The proxy website changes window.location to window._location
Only 5/7 attempts work below... How do i achieve the other 2?
var _location = {
set function(url) {
window.location = url + "?search=query";
},
get href() {
return window.location.href;
},
get protocol() {
return window.location.protocol;
},
get hostname() {
return window.location.hostname;
},
get pathname() {
return window.location.pathname;
},
set href(url) {
window.location.href = url + "?search=query";
}
}
_location.assign = function(url) {
window.location.assign(url + "?search=query");
};
_location.replace = function(url) {
window.location.replace(url + "?search=query");
};
console.log(window._location.href); // Working
console.log(_location.href); // Working
window._location = 'https://stackoverflow.com'; // NOT Working
window._location.href = 'https://stackoverflow.com'; // Working
window._location.assign('https://stackoverflow.com'); // Working
window._location.replace('https://stackoverflow.com'); // Working
_location = 'https://stackoverflow.com';// NOT Working