homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Javascript preloading
It doesn't always work.

WebmasterWorld Senior Member 10+ Year Member

Msg#: 24 posted 12:41 am on Dec 20, 2001 (gmt 0)

Has anyone else noticed this?

I'm talking about using the standard javascript:

name = new Image(x,x);
name.src = "./url/image.gif";

I use this both for preloading mouseovers and, sometimes, for preloading images on the next page.

The problem I've encountered is that, sometimes, mouseover images are not preloaded once the document has finished loading. Instead there is a pause onmouseover while the image is fetched from the server.

On top of that, there is sometimes a pause onmouseout while the original image is re-fetched. Also, this images are not catched after the first mouseover... They are continually refetched.

I have always written this off as a quirk of whatever broswer I was using at the time and forgotten about it. My thinking being that A, it doesn't always happen and B, javascript preloading is so universally used that it must actually work :-)

I'm not so sure, anymore... I've seen this problem in multiple versions of IE (including 5.x) and, now, in Netscape 6 the image being currently displayed will actually disappear while the replacement image is loaded both onmouseout and onmouseover.

The strange thing is that this is that this does not always happen. I just tried clearing the disk cache in NS6 and then reloading the page... Everything worked perfectly.

Stranger and stranger... Has anyone else noticed this? Any workarounds?



WebmasterWorld Senior Member tedster us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 24 posted 1:12 am on Dec 20, 2001 (gmt 0)

Yep, I've seen these and other brower cache quirks in both NN and IE -- it's as if they get befuddled and forget where thye stashed the file. However, I've never seen the browser go back to the server for an onMouseOut image that was previously rendered, unless one path was relative and the other absolute.

I'd like to understand this better -- I don't have any work-arounds either.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved