Answer the question
In order to leave comments, you need to log in
Adding code to a site using chrome.tabs.executeScript?
chrome.tabs.executeScript() method; I can add my code to the site to the existing tags, for example style or innerHTML, but only to the existing ones, I can’t create and add a new tag in it, is it not possible or am I doing something wrong?
Answer the question
In order to leave comments, you need to log in
chrome.webNavigation.onDOMContentLoaded.addListener(function (details) {
if (details.frameId == 0) {
chrome.tabs.executeScript(details.tabId, {
runAt:'document_start',
file: 'script.js'
});
}
})
var el = document.createElement('div');
el.innerText = "Hell world!";
document.body.appendChild(el);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question