JavaScript: 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.

JS in Depth

JS Obj Ref

DOM


DOM

Overview

Basic Examples

HTML Input

Web Scripting Examples

Web Scripting Misc

jQuery

node.js