Current location: Hot Scripts Forums » General Web Coding » JavaScript » JS to hide certain code acording to the keywords in the domain?


JS to hide certain code acording to the keywords in the domain?

Reply
  #1 (permalink)  
Old 10-01-08, 01:27 AM
carlatf carlatf is offline
New Member
 
Join Date: Oct 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up JS to hide certain code acording to the keywords in the domain?

Hi,

I need a piece of code that allows me to hide or show certain code depeding of certain keywords in the URL.

Basically I want to block adsense for all the urls in my site (search engine) that contains words in the URL like sex, drugs and the like to not infridge Google's TOS.

Anyone know of such a script?

Best regards,
Carla
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-01-08, 01:00 PM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
This cannot be done via JavaScript. Even if you used a script to remove the portions of code which contained certain words etc, GoogleBot and other crawlers/spiders would never be affected by those changes, as they don't execute scripts.
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 10-01-08, 03:16 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
The Adsense control panel lets you block certain advertisers and the Google Ad Review Center lets you preview ads before they're shown on your site. You can block ones you don't like by selecting them and providing a reason for the rejection.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 10-01-08, 04:19 PM
carlatf carlatf is offline
New Member
 
Join Date: Oct 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,
I think I didn't explained myself.

I need that if the query string contains for example the word "sex", then I don't display the Google ads inside my page.

Something like this could work?


if(window.location.indexOf("sex")){
document.getElementById('divConAdsense').style.dis play="none";
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 10-01-08, 05:29 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
You could do that either with javascript or on the server side. Just look for the word in the query string and set your divs or spans accordingly.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 10-01-08, 06:05 PM
carlatf carlatf is offline
New Member
 
Join Date: Oct 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks. What would be server side?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 10-04-08, 11:23 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Quote:
Originally Posted by carlatf View Post
Thanks. What would be server side?
Server side would be in the scripting language that runs on the server as opposed to in the browser...PHP, ASP, perl, etc.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 10-06-08, 10:01 AM
carlatf carlatf is offline
New Member
 
Join Date: Oct 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
If the Google adsense code is commented, it isn't loaded right?

I mean with
Code:
<!--  google adsense  -->
Couldn't I make appear the comments before-after the tag with JS?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search for domain name in a Database with Spell check srik4u PHP 1 03-24-06 12:06 PM
12 days of Christmas ! 12 coupons special ! mxhub General Advertisements 0 11-15-05 10:58 AM
How do I hide my webpages and show only domain name in browser adress field ? Drubbel Script Requests 2 07-28-04 01:38 PM
domain check ramez Script Requests 8 03-07-04 12:26 AM
code for creating sub domain in php majumder_sanjay Script Requests 0 09-04-03 07:50 AM


All times are GMT -5. The time now is 10:36 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.