Jquery: if referer contains 'keyword' then say this -


i want dynamically add div on webpage receives traffic google. lot of traffic comes people searching brands.

the idea identify url referer , see if contains of brands , using jquery: if referer contains brand-keyword add div saying:

'brand'? free quotes 'brand'

how can that?

lets assume keywords brands are:

brand1, brand2, brand3, brand4

if want go ahead regardless of @rob w's comment, following:

var arr = [ "one", "two", "three", "four", "five" ]; var referrer = "the number three";  $.each(arr, function(){      if (referrer.indexof(this) >= 0){         $('#id_of_your_div').html(this + '? free quotes ' + + '!');         return false;     }  });​ 

where arr list of words searching for, , referrer string you're looking in.

example: http://jsfiddle.net/ds4r3/1/


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -