How to use a variable in a function expression which is injected in a page?
- by anonymous
I'm trying to inject a function into a webpage via Chrome extension content script by:
function inject(code) {
var actualCode = '(' + code + ')();';
var script = document.createElement('script');
script.textContent = actualCode;
(document.head||document.documentElement).appendChild(script);
…