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

119
Vistas
Give access of script only to specific id in the url

I have a JavaScript file and want to load it only to some specific ids to load in head. The domain when user is logged in is www.domain.com?id=122 And the script url is www.domain.com/script.js And I put the script with parameter in head of home page if user is logged in www.domain.com/script.js?id=122 And I get the id from the current url by split and some JavaScript stuff. Now the problem is what to add in the script file to make the script load only for some specific ids

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

0

Technically you can check the URL parameter, and create a script tag from code only if you are satisfied:

if(location.search === "?id=122") {
  let s = document.createElement("script");
  s.src = "script.js";
  document.head.append(s);
}

However it's not something what could be used for security purposes for example.

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