S
S
Shane Matte2016-04-18 15:37:10
JavaScript
Shane Matte, 2016-04-18 15:37:10

How to access the source code of an open tab?

Hi. I am writing an extension for chrome. In the open tab, I click on the extension, it should change the background of the site. But nothing happens, the console is clean.

chrome.browserAction.onUpdated.addListener(function(tab) {
    chrome.tabs.executeScript(tab.id,{code:"document.body.style.background='red'"});
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question