Skip to content Skip to sidebar Skip to footer

Best Way To Purge Innerhtml From A Firefox Extension

I'm running web-ext lint and getting back a few errors like this: UNSAFE_VAR_ASSIGNMENT Unsafe assignment to innerHTML Due to both security and performance concerns, this may not

Solution 1:

Yes, that would be safer. For the example above it would be

var css = 'body { margin: 0; } iframe { border: none; }';
var style = document.createElement('style');
style.appendChild(document.createTextNode(css));
document.body.appendChild(style);

var frame = document.createElement('iframe');
frame.width = "100%";
frame.height = "100%";
frame.src = URL.createObjectURL(blob);
document.body.appendChild(frame);

To clear the document body prior there are several methods, see Remove all content using pure JS.

Post a Comment for "Best Way To Purge Innerhtml From A Firefox Extension"