-
-
Save brandonvanha/5f4e3e67eb2ee4e59318724625c12494 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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