I’m working on a Firefox add-on that will allow users (all of whom are part of a specific group, this add-on is very limited in audience) to see the status of their validation cookie in the status bar, We all need to be authenticated in order to access the sites, work-related, but we do not receive a warning when the cookie expires, so this leads to annoying and sometimes abrupt interruptions in work. In the end, this addition will allow us to send our credentials from the status bar without having to go to any reboots or redirects, but for now I just want it to show the status.
I looked at Mozilla's developer pages on nsICookie, nsICookie2, nsICookieManager, etc., and it’s not very clear how any of them fit into JavaScript or XUL or something else.
Ideally, I just want JavaScript to go beyond the bounds of the document and get a cookie string for the domain that I specify. If I could do this, it would allow porting the code to other browsers (in particular, Safari and Chrome). But if this should be browser specific, then I would like to at least learn how to check if a cookie exists in Firefox without any bells and whistles to configure or delete.
Simply put, I want to say:
if (cookieExists("sample.com", CookieName)) {
alert("You're signed in!");
} else {
alert('Go sign in, you fool!');
}
What is the easiest / most portable way to do this (on the browser side, of course)?
user56361