PDA

View Full Version : Show code/advertisement/text only if page content do not contain certain phrasses



Fli
12-18-2015, 12:08 PM
WHich code i can use to show for example Adsense Ad only on pages that do not contains bad phrasses?

ie: i have Adsense and i dont want to show ads on pages where in page content is "porn", "cigar"

There is Javascript based code:


<div id="notBarEnds">
Here Add code to be shown if page is free from bad words
</div>

<script>
if (/porn|sex|erot|cigar|drug/.test(window.location.href)) {
document.getElementById('notBarEnds').style.displa y = 'none';
}
</script>

Similar topic, if criteria is URL, not page CONTENT: Show code/advertisement/text only if page URL do not contain some phrasses (http://internetlifeforum.com/html-css-forum/2599-show-code-advertisement-text-only-if-page-url-do-not-contain-some-phrasses/)