Code: Select all
var tabs = require("sdk/tabs");
tabs.on('activate', function(tab) {
var worker = tab.attach({
contentScript: 'self.port.emit("html", document.body.innerHTML);'
});
worker.port.on("html", function(message) {
console.log(message)
})
});
Code: Select all
var contentHtml = '';
var tabs = require("sdk/tabs");
tabs.on('activate', function(tab) {
var worker = tab.attach({
contentScript: 'self.port.emit("html", document.body.innerHTML);'
});
worker.port.on("html", function(message) {
contentHtml = message
})
});
console.log(contentHtml);
What is the proper way of putting this into the variable contentHtml?
Thank you, Kim