Pre-loading external files (CSS, JavaScript) for other pages
Posted
by Jason Young
on Stack Overflow
See other posts from Stack Overflow
or by Jason Young
Published on 2009-06-29T18:39:08Z
Indexed on
2010/05/01
22:27 UTC
Read the original article
Hit count: 174
I'm curious if there is an efficient way to wait for the front page of a site to load, and then pre-load CSS and script files that I know will likely be needed for the other pages on the site.
I want the front page of the site to be as fast as possible (lean and mean). It's likely that the user will not immediately click on a link. Since there will likely be some idle time, this seems like an opportune time to pre-load some of the external assets. Pre-loading should cause them to become cached. When the user does click on another page, the only request needed will be for the content and possibly some images, etc.
Has anyone done this? Is it a bad idea? Is there an elegant way to implement it?
© Stack Overflow or respective owner