0👍
For Images you can use Image()
var imgpreload = new Image();
imgpreload.onload = function() {
// do stuff on image load
};
imgpreload.src = "/path/to/image.jpg"; // this has to be after `onload` event otherwise you'll face race condition
but for videos i don’t think you can do it outside the DOM
Source:stackexchange.com