Browser Sniffing >> Insert Browser Specific HTML
Posted: Mon Sep 13, 2010 8:18 pm
Hi, i'm trying to create a test that detects if a user is browsing with firefox. If the user is browsing with firefox i want the favicon to be directed to a animated gif. If the are not using firefox i want the favicon to directed to a standard non animated png favicon. I have researched around to try and find a solution using php but i'm very new to php and can't figure it out. if someone could give me a hand or point me in the right direction it would be much appreciated. My usual area is only HTML and CSS. Is php the best way to achieve this or should i be using another method eg. javascript. Thanks a lot! This is some code i have found and modified which doesn't work at all...
Code: Select all
<?php $browser = $_SERVER['HTTP_USER_AGENT']; ?>
<?php if (strstr($browser, "Firefox")) { ?>
<link rel="icon" href="address/favicon.gif" type="image/gif">
<?php }else{ ?>
<link rel="icon" href="address/favicon.png" type="image/png">
<?php } ?>