Showing the Adsense Firefox Referral Button to Non-Firefox Visitors
Filed in: Adsense Tips, Make Money Online, Open Source, Web Development — February 23rd, 2006There is no point showing the Firefox Adsense referral button to existing Firefox users. I used the following simple PHP code to show Firefox referral button to non-Firefox (Gecko) visitors only.
[php]
< ?php if ( !strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') ) { ?>
< ?php } ?>
[/php]
Simple huh? ![]()

Internet Explorer visitors see the Firefox referral banner.

Firefox visitors do not see the Firefox referral banner
Bug?
I want to keep the code as simple as possible, therefore, it can not do deep browser detection. Safari (Mac OS X) users will be treated as Firefox users as well. ![]()
Here is the better PHP browser detection script, if you are interested.


