Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 268
Registered: ‎08-19-2009
My Device: Bold 9700
Accepted Solution

Cookie support in OS5

Please tell me cookies are supported in OS 5 via javascript's document.cookie property. From my experience, they're not working... anybody have experience here? Any official word?

Developer
Posts: 164
Registered: ‎08-26-2010
My Device: Not Specified

Re: Cookie support in OS5

[ Edited ]

my experience in webworks is nothing problems when implementing cookies even in OS 5.

 

here are my javascript code functions i always use to implement cookies and they are working well:

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}

function checkCookie(c_name)
{

var username=getCookie(c_name);

if (username != null && trim(username) != "")
  {
  return true;
  }
else
  {
 
  if (username!=null && trim(username) != "")
    {
     return false;
    }
  }

}

function eraseCookie(name) {
	setCookie(name,"",-1);
}

 

Developer
Posts: 268
Registered: ‎08-19-2009
My Device: Bold 9700

Re: Cookie support in OS5

Thanks for the response. Do your cookies persist past a reboot?

Developer
Posts: 164
Registered: ‎08-26-2010
My Device: Not Specified

Re: Cookie support in OS5

 
Developer
Posts: 164
Registered: ‎08-26-2010
My Device: Not Specified

Re: Cookie support in OS5


shnuffy wrote:

Thanks for the response. Do your cookies persist past a reboot?


sorry got error on previous post,

 

about cookies, it will be removed every time after device get reboot.

So you cannot make it persistent.