开发者

jQuery check if Cookie Contains Text

开发者 https://www.devze.com 2023-03-13 11:03 出处:网络
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\")

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消