Preloading images with JavaScript

javascript

Solution

Yes. This should work on all major browsers.

Problem

Is the function I wrote below enough to preload images in most, if not all, browsers commonly used today? ``` function preloadImage(url) { var img=new Image(); img.src=url; } ``` I have an array of image URLs that I loop over and call the `preloadImage` function for each URL.

Original source

Related problems