How to make the browser (IE and Chrome) request images before scripts?

后端 未结 5 1915
说谎
说谎 2021-02-05 09:36

Note: If you are reading this for the fist time, you may jump directly to the UPDATE, since it addresses the issue more accurately.

So I got a

5条回答
  •  迷失自我
    2021-02-05 10:05

    Consider that the browser can't do anything till it builds the DOM. So first it parses the whole page, THEN it loads the images (even if they're from the CSS).

    You could load the images in DATA segments inline in the CSS or the page, that might speed those things up, or you could inject the jQuery reference after the page is loaded (say set a timer for 500 ms) but obviously that will affect usability to some extent.

    Now, I'm pretty sure this is all implementation dependent, you could always find a browser that would load images as it came to them, but consider what it means to build a DOM and then to fill it in.


    http://en.wikipedia.org/wiki/Data_URI_scheme

    If SO doesn't strip it, there should be a red dot between here and the code :\

    Red dot
    

    So that's what I meant, use the DATA URI scheme

提交回复
热议问题