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

230
Visualizações
youtube player api: Uncaught TypeError: a.next is not a function when loading script from www.youtube.com/iframe_api

the following problem: I load the player api as described here: https://developers.google.com/youtube/iframe_api_reference#Getting_Started

Then i get this error message: enter image description here

I get this error only on some domains. On other domains, it works fine. With the same video and the same iframe snippet.

unfortunately when this error occurs this callback function is never executed: onYouTubeIframeAPIReady

This is the main issue here.

If i wait a couple of seconds and execute the snippet manually:

  var tag = document.createElement('script');

  tag.src = "https://www.youtube.com/iframe_api";
  var firstScriptTag = document.getElementsByTagName('script')[0];
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

the error message does not appear. But onYouTubeIframeAPIReady is still not executed.

So it must be some kind of timing issue. But the problem never occurred to me before. Any hints on what might be the reason for that or easy workarounds would be appreciated.

Unfortunately, I am not allowed to share the affected domains.

about 4 years ago · Juan Pablo Isaza
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