How to not add content scripts to existing tabs after enabling a web extension?

Hello,

I wrote a web extension that uses content scripts exclusively. Unlike Chrom=
e, the scripts are injected into existing tabs when enabling the extension.=
 This leads to CSS and HTML fragments to be added twice by my script if som=
eone enables-disables-enables the extension. Since I (presumably) can't tid=
y up when the extension gets disabled, is there a way of disabling this beh=
avior?

Regards
0
webseiten
10/6/2016 3:47:08 PM
mozilla.dev.extensions 5694 articles. 0 followers. Post Follow

1 Replies
290 Views

Similar Articles

[PageSpeed] 54

On 10/6/16 9:47 AM, webseiten.designer@googlemail.com wrote:
> Hello,
> 
> I wrote a web extension that uses content scripts exclusively. Unlike Chrome, the scripts are injected into existing tabs when enabling the extension. This leads to CSS and HTML fragments to be added twice by my script if someone enables-disables-enables the extension. Since I (presumably) can't tidy up when the extension gets disabled, is there a way of disabling this behavior?
> 
> Regards
> 

That sounds like a bug that should be reported here:
https://bugzilla.mozilla.org/enter_bug.cgi?product=Toolkit&component=WebExtensions

And to give more of an answer, can't your script detect that it has
already acted on a page in order to avoid duplication?

Jorge
0
Jorge
10/6/2016 4:36:14 PM
Reply: