:
-, cookie Firefox, nsICookieManager nsICookieManager2 , cookie.
-, document.cookie, , , , , . document XUL-, , , . , . , . , , , , , . , XUL- :
function pageLoad (event) {
if (event.originalTarget instanceof HTMLDocument) {
var doc = event.originalTarget;
if (doc.URL.match(/^https?:\/\/[^\/]*\.example\.com\//)) {
⋮
doc.cookie = 'cookie_name' + "=" + value + ";expires=" +
(new Date(2050, 10, 23)).toGMTString();
⋮
}
}
}
var appcontent = document.getElementById("appcontent");
if (appcontent)
appcontent.addEventListener("load", function (e) { pageLoad(e); }, true);
With this approach, you can only interact with cookies that are associated with this page, using mechanisms that you are familiar with, and not worry about how to handle cookies associated with completely different pages.
source
share