Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda