Question

I have a tool that generates "standalone" HTML pages, which include embedded images.

I use binary representation of the images using base64 encoding and it works, but when there are a lot of such images in the HTML pages, it takes a 10sec while until !anything! is shown on the browser. But really, nothing is shown until everything is loaded, unlike pages with URL directed images, in which the images are loaded while the rest of the page is already shown.

Answering 1 or more of the below questions would really help me:

  1. Do you know a way to tell the browsers to load the images while showing the rest of the page, like it does for images with URL?
  2. Do you know a way to to accelerate the decoding?
  3. Do you know another way (else to base64) to represent binary data inside the HTML page, which has a weaker compression in comparison to base64, or which is not compressed at all, so it can be decoded faster by the browser?

Thanks!

Was it helpful?

Solution

Finally answering myself....

So introducing again the problem:

  • There are a lot of embedded binary images and it takes a lot of time to decode all of them
  • While the JavaScript code is running (and decoding), nothing is refreshed on the screen. You have to wait until it is all done

The solution (you can call it a workaround):

  • Delaying the script from time to time, letting the HTML be updated gradually at these delays, using the JavaScript function setTimeout().

This way I can start browsing my HTML document at the first ~10sec, while the pictures are loaded gradually

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top