Skip to content

Instantly share code, notes, and snippets.

@dance2die dance2die/popup.js
Last active Feb 17, 2019

Embed
What would you like to do?
chrome.tabs.query(
{ active: true, windowId: chrome.windows.WINDOW_ID_CURRENT },
function(tabs) {
const { id: tabId } = tabs[0].url;
let code = `document.querySelector('h1')`;
// http://infoheap.com/chrome-extension-tutorial-access-dom/
chrome.tabs.executeScript(tabId, { code }, function (result) {
// result has the return value from `code`
});
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.