Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

137
Visualizações
replacing the location fuction with custom function

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
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda