In a Firefox add-on built with the Add-on SDK, how can I disable and re-enable JavaScript for a single tab?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The SDK itself doesn’t provide this functionality, you will have to work with the XUL directly. What you need to do is accessing the
docShellproperty of the XUL<browser>element corresponding to the tab. The docshell has anallowJavascriptproperty that lets you switch JavaScript on and off. Something like this should work:Unfortunately, it doesn’t seem possible to take a
Tabobject and find the corresponding XUL element – you have to work with the XUL window from the start.Relevant documentation:
window-utilspackage (the propertiesactiveWindow/activeBrowserWindoware undocumented for some reason).<tabbrowser>element<browser>elementnsIDocShellinterface