I am working on a slideshow implementation. We have to prefetch images for better user experience. Currently I am using hidden img tags to trigger the image load. But when a user moves say from 1st image to 80th image, the prefetch image request started for the first image doesn't get cancelled.
Using iframes we can call stop()
on iframe object to stop loading the previous set of images. The norm for creating iframes using javascript appears to be
ifrm = document.createElement("IFRAME");
I dont want to do that as I dont want my iframes to be appended to DOM. There is a HTMLFrameElement
. But I am not sure how to use it.
So my question is, how to create iframes in javascript without accessing document object.