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
Post a Comment