How to create a chrome extension that adds code to the page

0

Extension Safe or not:

I need to add in a specific page (preferably) or in any case a simple code is simpler.

This works here:

var meucode = 'alert("oi");';
var script = document.createElement('script');
var code = document.createTextNode('(function() {' + meucode + '})();');
script.appendChild(code);
(document.body || document.head).appendChild(script);

It alerts all pages that I enter ...

Well, you can adapt this to add an "image" on the site that the person enters.

    
asked by anonymous 04.03.2015 / 19:42

0 answers