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

277
Vistas
How to listen for string after subdirectory website?

I need to run a JavaScript function when someone goes to https://website.com/custom/U1BJR09U. The U1BJR09U could be any string, but it needs to be passed on to the function. How should I go about implementing this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Assuming that all traffic is redirected to a single point that serves a main file handling the URL changes, this should do it:

const hasCustom = window.location.pathname.match(/^\/custom\/([0-9A-Z]+)$/);
if (hasCustom && hasCustom[1]) {
    const myString = hasCustom[1];
    /* Do something with myString here */
}

Explanation of the regexp:

  • ^ starts with\/ (escaped slash)
  • follows with custom
  • has \/ (another slash)
  • Matches ([0-9A-Z]+) numbers and uppercase letters
  • The string ends after numbers and uppercase letters
about 4 years ago · Juan Pablo Isaza Denunciar
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