Fatih Acet
Fatih Acet

Reputation: 29549

How to access window and document in Add-on SDK

I want to get active window's cookie information in an extension built with the Add-on SDK. How can I do this? I couldn't find any method in documentation that has access to window or document. Also in some forums, folks talk about there is no way to access to them. Is it really not possible still?

Upvotes: 4

Views: 1475

Answers (1)

therealjeffg
therealjeffg

Reputation: 5830

You can access document and therefore document.cookie via a content script; for more on working with content scripts, see the documentation:

https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/modifying-web-pages-url.html

Edit: here's a simple example that allows you to fetch cookie data for the current tab into the addon's main code:

https://github.com/canuckistani/jp-page-mod-cookie

Upvotes: 4

Related Questions