Forum Moderators: open

Message Too Old, No Replies

how to show different messages based on visitor's user agent

         

sa3er

3:09 pm on Jun 12, 2009 (gmt 0)

10+ Year Member



How we can show desired content based on visitors user agent ?
For example how we can Show a funny picture when visitor come by IE and show content when they use firefox ...

Seb7

5:16 pm on Jun 12, 2009 (gmt 0)

10+ Year Member



You need to look at the 'user agent' string. There are different ways of doing this, either by JavaScript, PHP, ASP etc..

<a href="javascript:alert(navigator.userAgent)">User Agent</a>

Also these maybe helpful too.

navigator.appName
navigator.appVersion

Many examples can be found on the net.

I'm sure someone we give an example of how to change an image based on user agent.

sa3er

6:20 pm on Jun 12, 2009 (gmt 0)

10+ Year Member



i'm noob. plz explain more clear or give me some helpful link or tut ..
tanx

sa3er

11:32 am on Jun 13, 2009 (gmt 0)

10+ Year Member



Does this work ? :
<script type="text/javscript">
var browser=navigator.appName;
if(browser == "Firefox")
document.write(/ what you want to show in FF)
else
document.write(// what you want to show in other browsers )
</script>