JS: Pre-Cache Images

By Xah Lee. Date: .

How to pre-cache Images?

Like this:

(new Image()).src = "cats.png";

The Image is a constructor that returns a HTMLImageElement object, which represents the image element.