Reputation: 353
I need to create/update/remove cookie for FireFox browser. This cookie is a client cookie, as in it has to be created by C++ executable and it will be present on the end user machine.
How can I achieve this?
Thank you
Upvotes: 0
Views: 466
Reputation: 57681
You basically have two options:
cookies.sqlite
) directly. It's a fairly simple SQLite database so there is nothing complicated about that. However, catch 1: this cannot be done while Firefox is running. Also, catch 2: the format might change in future (as happened before) and your application will stop working or, worse, break the file.nsICookieManager2
interface to add the cookie and then Add-on Manager API to uninstall itself immediately after that. Then your application would only have to run Firefox with the command line firefox -url file:///path/to/extension.xpi
(works even if Firefox is already running). The catch here: the user would need to confirm extension installation. So you cannot do it behind his back, you need to explain what is happening and why.Upvotes: 2