Click to See Complete Forum and Search --> : Brower detect ...again


hack3rman
12-17-2003, 06:26 AM
Hi, first let me say I know there's alot of posts regarding detecting the browser here, but I couldnt find anything specific to my problem. Thanks.

Im wondering if there is a way for my html webpage to identify if a person is using AOL, and if so, send them one picture, or if they're using any other browser send them another picture and what the code would be?

In lay-mans terms:

if (aol) show img-aol.jpg

else show img-everythingelse.jpg


Thanks.

Khalid Ali
12-17-2003, 07:07 AM
alert(navigator.userAgent)

should display the string which you can parse accordingly

hack3rman
12-17-2003, 10:45 AM
Thank you, however, I do not know how to do that. Could you please be a little more specific. Where do I put that info and how would I set up the if-then-else statement?

Thanks.

TheBearMay
12-17-2003, 03:08 PM
What Khalid is saying is to create a webpage with that piece of script in it, and then display the page using AOL. You will get an alert with the value of the browser that you can then use to test against. BTW when I use that with AOL 9 it just tells me that it's using IE under the covers....

jaegernaut
12-18-2003, 09:04 AM
I think something like this will work:

<script language="JavaScript">

if (navigator.userAgent.indexOf('AOL') != -1 )
{
showImg.src = "img-aol.jpg";
} else {
showImg.src = "img.jpg";
}
</script>


<img name="showImg">