Preload certain site images


(Matthew Dawson) #1

This idea fixes a small ux issue, but when you load a discourse forum with a cold cache, there is a small moment when you can see the image loading (depending upon your hosting setup, it can take longer or shorter amounts of time). It would be nice if Discourse preloaded both header images in the background, so by the time a user scrolls, they don’t see the loading part.

You can see it on meta if you clear the cache, but your CDN loads so fast it isn’t very noticable. On my hosted copy, it takes longer to load and is thus more noticeable.

Other images that are easy to see being used on the site should probably also be preloaded, but I’m not sure how you would find those. Most of them, I’d imagine, are probably used right away anyways.


(Dean Taylor) #2

You can configure your own:

Use this:
http://w3c.github.io/preload/#preload

And user the admin option to add to the </head>


(Jeff Atwood) #3

This isn’t really relevant to Discourse as we are a JavaScript app – until your browser retrieves and compiles the very large bundles of JS that make up Discourse, there’s nothing to do…

You can read a bit more about some ideas here:


(Kane York) #4

I think that @MJDSys is suggesting adding a link rel=preload for the small_logo_url (or whatever it’s called).


(Jeff Atwood) #5

Regardless the loading of the small 4kb image, which will have a
placeholder in the correct dimensions, pales in comparison to the 200+kb of
JavaScript the browser has to load, parse, and execute to get anything
other than a blank page displaying.

I am not against it just pointing out this is the micro-est of micro
optimizations.


(Sam Saffron) #6

Yeah, if anything this is where we should be experimenting


(Jacob Chapel) #7

I agree.

Have the ember team said anymore about fastboot recently?


(Sam Saffron) #8

@wycats and @tomdale have been plugging away, I think first go at react style rendering (which is slightly more optimised than react cause it has handlebars to work from) was just merged in this weekend.

I think it will take a bit longer but lots of progress is being made and the feature is sponsored which is awesome.


(Matthew Dawson) #9

I agree completely, it’s just a small papercut issue. I just noticed the loading of the logo image as especially pronounced, as it cause a flicker at the top of the page which continues. Once the logo is loaded, the transition is smoother. I guess loading the page didn’t bug me so much, as I knew I had to wait there.

That being said, I’m working on setting up my own Discourse site. It has so far been a great experience, and it is a wonderful application.

I tried that on my site, and neither Firefox nor Chrome seem to want to work with it. I’m going to keep poking at it, but this does seem like a great workaround for now. I’m really glad Discourse allows for such an easy change!