Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda