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

115
Vistas
Is it possible ot truely reload the image?

I am trying to determine the speed of loading an image by average

My code looks something like this

function test(){
    const now = performance.now();
    const image = new Image();
    image.src = "https://upload.wikimedia.org/wikipedia/en/thumb/8/80/Wikipedia-logo-v2.svg/1200px-Wikipedia-logo-v2.svg.png"
    image.onload = function(){
        const end = performance.now(); 
        const speed = end-now
        console.log(speed)
    }
}
setInterval(test,1000)

The code works fine, but the problem is after the image loaded for the first time, it will loaded very first from about (64ms to less than 1 ms in my side).

My guess is the broswer will keep some data of the image until the window reloaded or closed (correct me if I am wrong)

Is it possible to prevent this without using window.reload and truely reload the image??

Example:

enter image description here

Thanks for any responds!

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

0

Just add your now as a query parameter to your url:

function test(){
    const now = performance.now();
    const image = new Image();
    image.src = `https://upload.wikimedia.org/wikipedia/en/thumb/8/80/Wikipedia-logo-v2.svg/1200px-Wikipedia-logo-v2.svg.png?${now}`
    image.onload = function(){
        const end = performance.now(); 
        const speed = end-now
        console.log(speed)
    }
}
setInterval(test,1000)

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