473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

IE vs. Firefox, image.src swapping, offline vs online?

cjl
I have a website which allows people to view interesting radiology
cases. It is for teaching radiology residents. It is designed to run
in fullscreen or 'kiosk' mode, at 1024 x 768 resolution only.

http://www.casespace.net

I designed it with firefox (plus the autohide extension) in mind, but
also want to support IE.

Online and offline it works great in Firefox. Offline it also works
great in IE. The problem is with IE online. I allow the user to cycle
through images with either the page up / page down keys, or with the
mouse wheel, or toggle 'cine' mode with the space bar.

I preload all the images before cycling through them. However, when
viewing it online with IE, cycling through images is slow to the point
that it appears to be downloading them each time.

I am swapping images with a function that re-assigns the 'src' of an
image element.

Any thoughts?

-CJL

Nov 9 '05 #1
6 2241
cjl wrote:
[http://www.casespace.net]
I preload all the images before cycling through them. However, when
viewing it online with IE, cycling through images is slow to the point
that it appears to be downloading them each time.

I am swapping images with a function that re-assigns the 'src' of an
image element.

Any thoughts?


It would be prudent if you posted at least the URL of the script
you are referring to as the above website does not include one.

It would also be prudent if you did not serve XHTML als text/html
but HTML as text/html (since XHTML [as application/xhtml+xml] is
not supported by IE).
PointedEars
Nov 9 '05 #2
cjl

Thomas 'PointedEars' Lahn wrote:
It would be prudent if you posted at least the URL of the script
you are referring to as the above website does not include one.
Of course. Sorry. Here it is:
http://casespace.net/data/library.js

The code is complicated, and poorly written, but basically I am
preloading lots of high resolution images, and it's working in Firefox,
but not in IE 6.
It would also be prudent if you did not serve XHTML als text/html
but HTML as text/html (since XHTML [as application/xhtml+xml] is
not supported by IE).


I'm not sure I understand this comment. Are you referring to the
doctype?

-CJL

Nov 10 '05 #3
"cjl" <cj****@gmail.com> writes:
Thomas 'PointedEars' Lahn wrote:
It would also be prudent if you did not serve XHTML als text/html
but HTML as text/html (since XHTML [as application/xhtml+xml] is
not supported by IE).
I'm not sure I understand this comment. Are you referring to the
doctype?


No, he's talking about the HTTP Content-Type header sent by the
webserver. This is rather low-level stuff (that means: JS is not
responsible or capable to change that), but IE indeed doesn't seem to
like documents that are served as application/xhtml+xml.
(I discovered that while toying with VML)
-CJL


Arnaud
Nov 10 '05 #4
cjl wrote:
Thomas 'PointedEars' Lahn wrote:
It would be prudent if you posted at least the URL of the script
you are referring to as the above website does not include one.
Of course. Sorry. Here it is:
http://casespace.net/data/library.js

The code is complicated, and poorly written,


It's better than I have come to expect of such scripts, yet there are
some possibilities of improvement left. For example, you need the
reference to the element with ID 'right_image' very often. It is
highly inefficient to obtain that reference every time it is needed
with document.getElementById('right_image'); the reference can be
stored in a variable once and that variable can be used instead.

Compare: <http://PointedEars.de/scripts/test/hoverMe/>
but basically I am preloading lots of high resolution images, and
it's working in Firefox, but not in IE 6.


Maybe IE's current cache size is just not big enough?
It would also be prudent if you did not serve XHTML als text/html
but HTML as text/html (since XHTML [as application/xhtml+xml] is
not supported by IE).


I'm not sure I understand this comment. Are you referring to the
doctype?


Exactly. As Internet Explorer does not support XHTML, such markup
is subject to error-correction where the SGML NET delimiter is ignored
(in HTML, <br /> is equivalent to <br>&gt;). Firefox and all other
Mozilla/5.0 based user agents support XHTML, however to have it parsed
as XHTML and not as error-corrected HTML, it has to be served with
the proper XHTML Content-Type: application/xhtml+xml. Unfortunately,
IE does not accept responses with this Content-Type since it does not
understand XHTML. There are other ramifications in using XHTML, such
as that document.write() cannot be used since it is not properly
implemented in the XHTML DOM although specified for XHTML 1.0 Transitional
in W3C DOM Level 2 HTML. So nowadays it is still best to not use XHTML
at all if not needed (for example when embedding SVG or MathML).

<http://www.hixie.ch/advocacy/xhtml>
PointedEars
Nov 10 '05 #5
cjl

Thomas 'PointedEars' Lahn wrote:
It's better than I have come to expect of such scripts, yet there are
some possibilities of improvement left. For example, you need the
reference to the element with ID 'right_image' very often. It is
highly inefficient to obtain that reference every time it is needed
with document.getElementById('right_image'); the reference can be
stored in a variable once and that variable can be used instead.
Thank you, I will make this change.
Maybe IE's current cache size is just not big enough?


This doesn't seem to be the problem. Let me elaborate. No matter what
the size of the cache is, or the cache settings are, when I dynamically
change the 'src' of an image to a preloaded image in Internet Explorer
there is network activity (I think it is checking to see of the
requested image is the same as the one in the cache). Firefox doesn't
do this, and swaps the image with the preloaded image with no network
activity, and very quickly.

Is there something wrong with the way that I preload images? Or is it
something wrong with the headers my servers sends, as detailed here:
http://www.mnot.net/cache_docs/

Is there something happening where image 'src's created statically
(explicitly) are appropriately handled, by dynamic 'src's (generated by
variables) are rechecked before being displayed?

Any help would be greatly appreciated.
-CJL

Nov 10 '05 #6
cjl
OK, I'm stumped.

Other scripts which dynamically swap the .src of an image object to a
'variable named' preloaded image do not make IE 6 check the network
against the cache, but my script does.

I am either preloading incorrectly (althought it works in Firefox) or I
am image swapping incorrectly (although it works in Firefox).

Help?

-CJL

Nov 10 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Michael Kennedy | last post by:
Hello, I want to create a website which allows students at my college to log in and list their second hand books for sale. Students would need to log in using their own individual account, and...
8
by: OysterCracker | last post by:
Hi - I've previously used js to swap images on mouseover in a menu. I'm stumped on a different situation and would appreciate some advice. I would like to swap imageA to ImageB when I mouseover...
23
by: Erik Schulp | last post by:
Hi all, I am using a background image via a stylsheet. I've used this code: background-image:url("/images/tile.gif"); (which I think is correct) The image doesn't show up however, the path,...
4
by: Dennis Allen | last post by:
Hi. I have one image that has to show up in a html page several times. To save time, I'd like to preload this image. As an example: if (document.images) { tester = new Image()...
7
by: cjl | last post by:
OK: I am really scratching my head over a preload / image swapping problem, so I started conducting experiments: http://www.saintrays.net/experiment1.html...
0
by: bkow | last post by:
I am having this problem Server Config System : Sun E250 ( 2 hard disks - One is a mirror) 1 GB ram OS : Solaris 7 Db2 : version 7.2 Running software raid for mirroring. The production and...
2
by: John | last post by:
Hi I need to write a vb2005/sql server2005 app running over a LAN. Some users who use laptop need to have the app to have an offline mode for when they are away. I am new to net and would like...
2
by: firstexact | last post by:
Hi guys, First post, hope you can help, I have done two sites www.trisant.co.uk and my own www.firstexact.co.uk. The 2 x 2 grid I originally envisaged goes haywire in Firefox as I get a 4 high by...
1
by: heyi | last post by:
hi, i'm making an app which uses a webbrowser control to show some offline (not cache) html pages like a slide show. let's say pages in a folder on the desktop etc... when it came to testing...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.