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

152
Visualizações
how would I keep my js code from working on certain subdomains

if I am trying to execute a warning to the console every time the url switched how would I exclude a website such as twitter.com/(username)/topics if the username is unique to the user every time

let lastUrl = location.href;
new MutationObserver(() => {
const url = location.href;
if (url !== lastUrl) {
lastUrl = url;

onUrlChange();



}

}).observe(document, {subtree: true, childList: true});

`window.__ttrExcludeUrls = ["https://twitter.com/explore",` "https://twitter.com/home","https://twitter.com/notifications", "https://twitter.com/messages", "https://twitter.com/i/bookmarks","https://twitter.com/i/moment_maker","https://.twitter.com/i/*"];



 function onUrlChange()
    {
      console.warn("URL changed", location.href);
    
      if(window.__ttrExcludeUrls.includes(location.href) == false)
      {
        console.log("THIS IS A TEST MESSAGE")
      }
      else
      {
        console.warn("WRONG URL")
      }
      if(location.href == "https://twitter.com/home")
      {
        console.warn("WRONG URL")
      }
      
    }
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