Slow loading images, best way to display temporary image? JQuery perhaps?

后端 未结 6 1085
死守一世寂寞
死守一世寂寞 2021-01-12 01:47

I am using Google Charts to display charting data in my application. Sometimes Google is slow and the charts will take a while to load. This scenario seems to be a common en

6条回答
  •  清酒与你
    2021-01-12 02:28

    Preloading is not the way to go. If your image is directly visible in your application, your browser will load it as fast as possible and will not be able to load it faster using Javascript.

    What you can do is to load it slower.

    You seem to consider the image loading is slow because you want it to be immediate. Hard to be faster than immediate.

    Maybe you can try the other way. Design your application so that the chart is displayed when the user interacts with something (click a button, a link, etc.), then load the chart whenever the user asks for it.

    I see 2 advantages to this, mainly for low bandwidth users (mobile users?):

    • users who don't want the chart won't be disturbed by its long loading process
      • you know like page layout changing while image is loaded
    • the initial bandwidth usage of your application will be lower which will make it look more responsive
      • the less images to load initially, the faster the browser will be ready

    Idea shamelessly stolen from AppleInsider mobile-version

提交回复
热议问题