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

223
Visualizações
YouTube is blocking javascript execution for around 10 seconds

I'm facing a very strange problem. I'm loading dynamically Google Charts when users are clicking on specific button. Everything works fine except that when I have YouTube videos in my page.

If I click in the first 10 seconds on one of the button that generates a chart, the chart execution is delayed. If I wait until YouTube has finished loading, the chart is loaded very fast.

I embed my videos like this:

<iframe loading="lazy" src="https://www.youtube.com/embed/WTtyAey5NCY" width="100%" height="400px" title="YouTube432"></iframe>

When loading my page, I see first those requests made by YouTube (even if the videos are not in the viewport!):

enter image description here

Those calls correspond to the videos I have in the page but after those first line, I get the following calls:

enter image description here

and then finally this:

enter image description here

When all YouTube events have finished sending data, my scripts are executed. If I try to execute scripts before the end of those events, they are put on hold until the events are completed.

In my CSP I have this:

Header set Content-Security-Policy "default-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.googleapis.com https://*.googletagmanager.com https://www.google-analytics.com/ https://www.google.com https://cse.google.com https://*.gstatic.com https://www.youtube.com/"

YouTube calls should not be blocked so I don't know why YouTube is doing this, it used to work one week ago. Should I block those calls with CSP? If yes, how?

Or is there something else I should do to avoid having all those calls?

Thanks Laurent

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