I need some help understanding something.
What i have so far is extension parsing page and injecting link on match. What i want is to open my extension /tab.html and fill input field there with a variable that i get from the content script. So far i got this working.
I have in background.js this
chrome.extension.onMessage.addListener(function(request, sender, sendResponse) {
chrome.tabs.create({url: chrome.extension.getURL('tab.html')}, function(tab) {
request_s = request.x+' '+request.y;
console.log(request_s);
});
});
which works.
I have the tab opened and the request, but no matter what i do it seems I can't get to change the value of the input field in tab.html I tried with $('#id').val(request_s), but as it seems dom is not ready, so nothing happens.
So i tried to add in background
chrome.tabs.onUpdated.addListener(function(tabid, changeInfo, tab) {
if(changeInfo.status == "complete" && tab.url == chrome.extension.getURL('tab.html')) {
console.log($('body'));
}
});
and log body innerhtml contains only the scripts of tab.html . Any advice what should i do to access tab.html dom when ready?