BillyRayPreachersSon
Programmer
I'm trying to come up with a way to detect if images are enabled in a user's browser.
This is what I've come up with so far:
However, I'd like to be able to remove the reliance on a timer, and also remove the reliance on a remote image.
Can anyone shed any light on how I might achieve either of these goals?
Thanks!
Dan
Coedit Limited - Delivering standards compliant, accessible web solutions
[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
This is what I've come up with so far:
Code:
var detectImagesTimer = null;
var detectImagesImage = null;
function detectImages() {
detectImagesImage = new Image();
detectImagesImage.onload = detectImagesPass;
detectImagesImage.onerror = detectImagesFail;
detectImagesTimer = setTimeout('detectImagesFail();', 500);
detectImagesImage.src = '[URL unfurl="true"]http://www.google.co.uk/intl/en_uk/images/logo.gif';[/URL]
}
function detectImagesFail() {
detectImagesTimer = null;
alert('Images are not enabled');
}
function detectImagesPass() {
if (detectImagesTimer) clearTimeout(detectImagesTimer);
alert('Images are enabled');
}
detectImages();
However, I'd like to be able to remove the reliance on a timer, and also remove the reliance on a remote image.
Can anyone shed any light on how I might achieve either of these goals?
Thanks!
Dan
Coedit Limited - Delivering standards compliant, accessible web solutions
[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]