As part of a web app, once images have been downloaded and rendered on a web page, I need to determine an image\'s file size (kb) and resolution within the browser context (
Service workers have access to header informations, including the Content-Length
header.
Service workers are a bit complicated to understand, so I've built a small library called sw-get-headers.
Than you need to:
response
eventContent-Length
header!Note that your website needs to be on HTTPS to use Service Workers, the browser needs to be compatible with Service Workers and the images must be on the same origin as your page.