homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Google / Google AdSense
Forum Library, Charter, Moderators: incrediBILL & jatar k & martinibuster

Google AdSense Forum

modifying firefox referral code
Targeting non-FF users

 5:42 am on Jun 1, 2006 (gmt 0)

The TOS say that we're not allowed to modify the adsense code. What about if I only want a Firefox referral button to appear in non-Firefox browsers? I assume that if I wrap the supplied javascript in an if statement then that's not modifying it, but I can't get javascript to do a conditional <script type="text/javascript" src="..."> However, using document.write('<script type="text/javascript" src="...">') I can get it to work.

Would this be legal? Or more generally, does modifying the adsense code as mentioned in the TOS refer to the code generated on the adsense site, or does it refer to the .js file that's downloaded from the google server?

Thanks in advance.



 7:05 am on Jun 1, 2006 (gmt 0)

I think this is too close to modifying the code.

If I were you, I'd head over to the PHP forum and get a PHP solution. That way, the code won't even exist if the user has Firefox.


 8:01 am on Jun 1, 2006 (gmt 0)

You could always try putting the Firefox referral code in a conditional comment, wich incidently only is supported by Internet Explorer:

<!--[if IE]>

Referreal script


That wouldn't modify the actual code but only display it to IE users.


 12:12 pm on Jun 1, 2006 (gmt 0)

I use this PHP solution:

if(stristr($HTTP_USER_AGENT, 'firefox') === FALSE)
// Show Firefox ad
// Show some other ad


 4:35 pm on Jun 1, 2006 (gmt 0)

Welcome to WebmasterWorld alexisw,

though that only works if you have register_globals on barns

this would be better

if(stristr($_SERVER['HTTP_USER_AGENT'], 'firefox') === FALSE)
// Show Firefox ad
// Show some other ad

[edited by: jatar_k at 2:04 am (utc) on June 2, 2006]


 1:49 am on Jun 2, 2006 (gmt 0)

Alrighty, PHP seems like the way to go. Thanks.


 8:36 pm on Jun 2, 2006 (gmt 0)

PHP or anything that you can do some limited server side processing. I'm poretty sure you can get the same reseult with mod_rewrite and a few server side includes.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Google / Google AdSense
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved