yardbird
06-27-2005, 03:55 AM
Hey all,
Need some help with IE6 and problem with random slide show.
Problem is, every time the image changes, IE goes out to the net to re-get the image, even though all are preloaded. Firefox works fine and seems to use the preloaded images.
I have put the following in my .htaccess and verified that the expiration on the headers for these images is a month out.
BrowserMatch "MSIE" brokenvary=1
BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
BrowserMatch "Opera" !brokenvary
SetEnvIf brokenvary 1 force-no-vary
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/png A2592000
I have tried all the settings in IE regarding when the reload of the page takes place, though in truth, automatic is the default setting, and what most users will have. None make a bit of difference anyway. IE continues to re-get the image from the network.
So - - - at this point it's either something about my javascript that I don't see or something about IE I don't know.
*******
CODE
*******
dog_array = new Array();
/* 1) preload dog face images, giving them names. Use array for randomizing by index. (if javascript allowed)
Use this method - some free javascript methods download the image file again for each display !
*/
darla = new Image(100,100); darla.src = "images/faces/Darla100.jpg"; dog_array[dog_array.length] = 'darla.src';
beamer = new Image(100,100); beamer.src = "images/faces/Beamer100.jpg"; dog_array[dog_array.length] = 'beamer.src';
ebony = new Image(100,100); ebony.src = "images/faces/Ebony100.jpg"; dog_array[dog_array.length] = 'ebony.src';
{ more dogs - - - yada yada yada }
/* showRandFace function - requires 2 arguments
1) time - number of milliseconds to leave each slide in place
2) numpic - image in array currently showing
*/
function showRandFace(time, numpic) {
face_num=numpic;
// while randomly selected image is same as last image shown, select another
while (numpic==face_num) {
face_num=parseInt(Math.random()*dog_array.length); // select random image
face_num=(isNaN(face_num))?0:face_num; // set to zero if results undefined}
}
if (document.images)
{
document.images['slide'].src = eval(dog_array[face_num]); // replace the image
}
setTimeout("showRandFace("+time+","+face_num+")",time); // recursive call after specified milliseconds
}
dog_num=parseInt(Math.random()*dog_array.length); // select image
dog_num=(isNaN(dog_num))?0:dog_num; // set to zero if results undefined
document.write("<img src='"+dog_array[dog_num]+"' id='faces' name='slide' border='0' hspace='5' vspace='0' align='top'>");
showRandFace(2500,0);
*****
Thanks in advance for reading this and any help you may give.
Need some help with IE6 and problem with random slide show.
Problem is, every time the image changes, IE goes out to the net to re-get the image, even though all are preloaded. Firefox works fine and seems to use the preloaded images.
I have put the following in my .htaccess and verified that the expiration on the headers for these images is a month out.
BrowserMatch "MSIE" brokenvary=1
BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
BrowserMatch "Opera" !brokenvary
SetEnvIf brokenvary 1 force-no-vary
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/png A2592000
I have tried all the settings in IE regarding when the reload of the page takes place, though in truth, automatic is the default setting, and what most users will have. None make a bit of difference anyway. IE continues to re-get the image from the network.
So - - - at this point it's either something about my javascript that I don't see or something about IE I don't know.
*******
CODE
*******
dog_array = new Array();
/* 1) preload dog face images, giving them names. Use array for randomizing by index. (if javascript allowed)
Use this method - some free javascript methods download the image file again for each display !
*/
darla = new Image(100,100); darla.src = "images/faces/Darla100.jpg"; dog_array[dog_array.length] = 'darla.src';
beamer = new Image(100,100); beamer.src = "images/faces/Beamer100.jpg"; dog_array[dog_array.length] = 'beamer.src';
ebony = new Image(100,100); ebony.src = "images/faces/Ebony100.jpg"; dog_array[dog_array.length] = 'ebony.src';
{ more dogs - - - yada yada yada }
/* showRandFace function - requires 2 arguments
1) time - number of milliseconds to leave each slide in place
2) numpic - image in array currently showing
*/
function showRandFace(time, numpic) {
face_num=numpic;
// while randomly selected image is same as last image shown, select another
while (numpic==face_num) {
face_num=parseInt(Math.random()*dog_array.length); // select random image
face_num=(isNaN(face_num))?0:face_num; // set to zero if results undefined}
}
if (document.images)
{
document.images['slide'].src = eval(dog_array[face_num]); // replace the image
}
setTimeout("showRandFace("+time+","+face_num+")",time); // recursive call after specified milliseconds
}
dog_num=parseInt(Math.random()*dog_array.length); // select image
dog_num=(isNaN(dog_num))?0:dog_num; // set to zero if results undefined
document.write("<img src='"+dog_array[dog_num]+"' id='faces' name='slide' border='0' hspace='5' vspace='0' align='top'>");
showRandFace(2500,0);
*****
Thanks in advance for reading this and any help you may give.