attachTo and iframes

Im working on an Addon which injects some HTML into the main page. But on sites with iframes, (Linkedin, Twitter, etc.) the HTML also ends up in the iframes. I was using
$('html').append(html);
I tried using attachTo: ["existing","top"] but this appends the HTML only after reloading the page.
I also tried using

if (window.top === self) { $('html').append(html); } else { $(parent.document.body).append(html); }

This appends the HTML but i get an error permission denied to access property 'document'

Could someone guide me on how to append to the main page DOM without appending to iframes. Id be eternally grateful.

If your add-on works only on specific domains, you can grant it a list of always accessible domains.

But Im trying to exclude iframe interaction entirely from my addon. Is there no way I can do that?

Try:

if (window.frameElement) {
 // its an frame, skip it
} else {
  // its not a frame
}