javascript - Run script in newly opened tab -


i'm writing chrome extension open new tab. question how can newly opened tab? when reach new tab, want make changes in source code. this; https://developer.chrome.com/extensions/tabs#method-create creates new tab. want make changes before user click tab. (change selected value , run inside function)

how can method create?

there callback parameter chrome.tabs.create, call chrome.tabs.executescript inside , inject code created tab.

chrome.tabs.create({url: 'http://www.google.com'}, function(tab) {     chrome.tabs.executescript(tab.id, {code: 'document.body.style.backgroundcolor = 'green;'}); }); 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -