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

165
Vistas
How to detect an ES module imported in the browser?

I have a script meant to be imported in the browser. It can be used in two ways, either as a regular <script src="..."> or as an ES module.

I would like it to behave differently depending on whether it was imported or loaded as a <script>.

Is it possible to detect either at runtime?

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

0

You can check for document.currentScript inside your script. Imported modules don't support it.

about 4 years ago · Juan Pablo Isaza Denunciar

0

There might be a more neat way but a functional workaround can be to read the document and see if script tag with certain src exists or not.

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