Background.js:
chrome.tabs.executeScript(tab.id,
{
file: "exec_script.js"
}, function(res) {
console.log(res);
});
exec_script.js:
var test = html2canvas(document.body, {
allowTaint: false,
letterRendering: true,
logging: true
}).then(function (canvas) {
var dataUrl = canvas.toDataURL();
var bImage = dataUrl.replace('data:image/png;base64,', '');
});
test
As far as I know, the last statement in exec_script.js have to be passed to the callback as the result parameter. But it returns empty object.
But if I make as following in exec_script.js:
var test = "good";
test
It returns a value of the variable to the callback.
Also the tab is not focused.