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

198
Visualizações
Slow page with multiple iframes

I have page with 20 modals and every each of them opens an iframe with youtube video in it. The problem is that the page is painfully slow because of it. Do you have any suggestions how can I fix this? Another thing is that I'm getting this error:

The service worker navigation preload request was cancelled before 'preloadResponse' settled. If you intend to use 'preloadResponse', use waitUntil() or respondWith() to wait for the promise to settle.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

On page load, browser is trying to download all the youtube videos.
So it gets slow.
If you load videos on modal click, page load time will be better.
Something like that:

function domReady(callback) {
    document.readyState === 'interactive' || document.readyState === 'complete' ? callback() : document.addEventListener('DOMContentLoaded', callback);
}

domReady(function () {
    const videoModals = document.getElementsByClassName('video-modal');

    Array.from(videoModals).forEach((el) => {
        el.addEventListener('click', function () {
            // load video
        });
    });
});
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