jQuery check if Cookie Contains Text
Trying to check to see if a cookie contains specific value of text. Is there a way to do this? For instance, my current cookies value is 'www.yahoo.com', but this tells me that $.cookie("referrer") is null, when it is actuall开发者_开发百科y not:
if ($.cookie('referrer').contains('yahoo')){
alert('YOU CAME FROM YAHOO!') }
I believe cookie
returns a string value which does not support contains
in javascript. You should use indexOf
.
精彩评论