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

131
Vistas
CDN not adding methods/properties to window object when trying to use iFrameResizer

I am trying to use the iFrameResizer package on a parent site and embed a basic react page via an iframe. To the parents site's index.html I've added the following code:

<iframe frameborder="0" id="sizetracker" src="http://localhost:3001" width="100%"
    style="position: fixed; z-index: 1000; bottom: 0; right: 0"></iframe>
<script src="https://cdn.jsdelivr.net/npm/iframe-resizer@4.2.11/index.min.js"></script>
<script>
    window.iFrameResize({ log: true }, '#sizetracker') // error thrown here
</script>

I'm using a cdn to add the package. I've tried the CDN from unpkg (via https://unpkg.com/iframe-resizer@4.3.2/index.js) as well as the url in the src attribute above that I got from js-delivr.

Two errors are thrown:

  1. Uncaught ReferenceError: module is not defined - this seems to be coming from the CDN's index.js
  2. Uncaught TypeError: window.iFrameResize is not a function - I'm guessing this is because of the above failed error.

How can I correctly import via CDN and then use that npm package in script tags in my html?

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

0

CDN Link was pointing to the wrong JS file. Don't use the one from jsdelivr or direct from unpkg. Instead use: https://cdn.jsdelivr.net/npm/iframe-resizer@4.2.11/js/iframeResizer.min.js

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