471,853 Members | 1,525 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Browser enable image

hi all,
i need ur help pls.
how can i detect the client browser setting with javascript. example:
the client browser blocked Popups. this example i could solve it, but
what i need is right now, how can i know if the browser of the client
are enable images to display.

if u dont understand my question, pls tell me and i will describe it
again.
thanks and i hope for answer.

best wishes,
sarmad
Sep 7 '08 #1
3 1115
SAM
sa*************@googlemail.com a écrit :
how can i know if the browser of the client
are enable images to display.
I don't know.
Why that for ? (what about accessibility ?)

<html>
<script type="text/javascript">
var imags = false;
window.onload = function() {
alert('images accepted ? '+imags);
}
</script>
<img src="image_test.gif" alt="text images" onload="imags=true;">
</html>
Seems to work in my Fx,
(even with images blocker (Estension: Web Developer) --false)
and also : Safari, Opera and IE.6-standalone
--
sm
Sep 7 '08 #2
sa*************@googlemail.com wrote:
how can i know if the browser of the client are enable images to
display.
The only mechanism I can think of is to run some JavaScript at the
beginning of the page load (inline, near the start of the HTML) that
stores the time, and then again in the onLoad event where it subtracts
the load time from the current time. Include an image which is huge,
but preferrably invisible.

If the page takes a long time to load, then presumably the browser
downloaded the image, so has images enabled.

This approach has so many flaws that I don't have the time to list them.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Sep 8 '08 #3
SAM
Steve Swift a écrit :
sa*************@googlemail.com wrote:
>how can i know if the browser of the client are enable images to
display.

The only mechanism I can think of is to run some JavaScript at the
beginning of the page load (inline, near the start of the HTML) that
stores the time, and then again in the onLoad event where it subtracts
the load time from the current time. Include an image which is huge,
but preferrably invisible.
I think we have not to wait downloading time since compliant graphical
browsers wait all images are loaded before to launch the JS 'onload'
attributed to the body tag.
If the page takes a long time to load, then presumably the browser
downloaded the image, so has images enabled.
You can also use an 'onload' in a transparent very small image to toggle
a variable defined previously in the head.
This approach has so many flaws that I don't have the time to list them.
See my code given in my previous post.

Tested on my browsers, it seems to work (except in IE Mac which launches
the body onload before loading images) but I don't know what that could
give in a text browser ?
(do text browsers use JS ? if yes, what that can give with dhtml ?)

--
sm
Sep 8 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by CJ Oxx | last post: by
12 posts views Thread by Kepler | last post: by
25 posts views Thread by Ryan Stewart | last post: by
10 posts views Thread by Viken Karaguesian | last post: by
4 posts views Thread by satish mullapudi | last post: by
NeoPa
reply views Thread by NeoPa | last post: by
aboka
reply views Thread by aboka | last post: by

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.