Skip to content

Instantly share code, notes, and snippets.

@citylims
Created November 24, 2015 02:42
Show Gist options
  • Save citylims/050e18621dc9dd923411 to your computer and use it in GitHub Desktop.
Save citylims/050e18621dc9dd923411 to your computer and use it in GitHub Desktop.
Semantics with google chrome api
//execute my jquery script in chrome tabs;
//execute my content script in the chorme tabs;
chrome.tabs.executeScript({ file: "jquery.min.js" }, function() {
chrome.tabs.executeScript({ file: "scripts/content.js" });
});
//when a new chrome tab is created run my function;
chrome.tabs.onCreated.addListener(function(tabId, changeInfo, tab) {
refeshScript();
});
//when a chrome tab becomes active;
//run my function on that tab;
chrome.tabs.onActivated.addListener(function(activeTab) {
chrome.tabs.get(activeTab.tabId, function () {
refreshScript();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment