Closed lkintact closed 3 years ago
Maybe something like this around line 67 of inline.js:
if (window.performance){
var imgp = performance.getEntriesByName(im.src);
if (imgp[0] && imgp[0].decodedBodySize > 0){
spn.innerText += ' (' + imgp[0].decodedBodySize.toLocaleString() + ' bytes)';
}
}
Like so:
Thank you for the bug report! I wanted to see the feasibility of this before responding to the issue, and I ran a few tests with the Performance API (thank you very much for the suggestion @jscher2000).
Unfortunately, there is a recurring case where the getEntriesByName
call returns an empty array. Strangely, refreshing the inline page returns the proper results.
At first I thought it was a race condition, maybe I was requesting the data before it was set. Adding a PerformanceObserver
in the mix did not help. I periodically polled the whole entry list with getEntries
instead, and saw that the relevant PerformanceResourceTiming
entries are never registered.
For now, I can't get it to work reliably. I will keep looking into this.
(If anybody else is interested in looking into this, you can replicate this problem with the main Google logo in the Google main page)
Hmm, bummer. I have some elaborate code to bypass the cache, which might be why I can get the value.
That might be more trouble than it's worth.
Closing this issue, since I was unable to find a reliable method for this.
Thank you for implementing #13. What would you say about adding the file size to the image description, too?
Behind! version: 0.2.15, Browser: Firefox 88.0.1.