Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need help in using cookies in xul file

4 views
Skip to first unread message

kanda

unread,
Oct 5, 2009, 9:44:26 PM10/5/09
to
Hi,

I'm right now creating an extension for firefox.I want to read a
cookie in the xul file . This cookie was previously created using
javascript in an html page.

When i use the same script in the xul file i cannot retrieve the
cookie. Is this possible??

I'm a newbie in creating extensions so please tell me a solution for
this problem or a tutorial where i could find answers for this
question,because i couldnot find the relevant details in firefox
forums.i used the following javascript functions for handling cookie.

function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring
(nameEQ.length,c.length);
}
return null;
}

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

Alexander Limi

unread,
Oct 6, 2009, 3:17:38 PM10/6/09
to kanda, dev-us...@lists.mozilla.org
I think you're on the wrong list. :)

This list is for usability and UI discussions.

(Sorry that I can't help :)

--
Alexander Limi · Firefox User Experience · http://limi.net

> _______________________________________________
> dev-usability mailing list
> dev-us...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-usability
>

0 new messages