From 8139390f4df74822df8d485176bac88a66f912de Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 9 Dec 2006 17:23:34 +0100 Subject: [PATCH] Fix some issues with IE preloading. --- files/pr0n-fullscreen.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/files/pr0n-fullscreen.js b/files/pr0n-fullscreen.js index 857f3d9..3a7dba6 100644 --- a/files/pr0n-fullscreen.js +++ b/files/pr0n-fullscreen.js @@ -96,12 +96,14 @@ function prepare_preload(img, width, height, evt, filename) preload.src = ""; preload.parentNode.removeChild(preload); } - - if (document.all) { // IE-specific - img.onload = "display_image(" + width + "," + height + ",\"" + evt + "\",\"" + filename + "\",\"preload\");"; + + // grmf -- IE doesn't fire onload if the image was loaded from cache, so check for + // completeness first; should at least be _somewhat_ better + if (img.complete) { + display_image(width, height, evt, filename, "preload"); } else { - img.onload = function() { display_image(width, height, evt, filename, "preload"); } - } + img.onload = function() { display_image(width, height, evt, filename, "preload"); }; + } } function relayout() -- 2.39.2