You can use the last expression evaluated by the executed code in a callback function:
chrome.tabs.executeScript( {
code: "window.getSelection().toString();"
}, function(selection) {
document.getElementById("output").value = selection[0];
});
More Related Contents:
- Chrome Extension how to send data from content script to popup.html
- Checkbox Check Event Listener
- Completely lost on how to save extension popup window content
- Making a Chrome Extension download a file
- Chrome Extension “Refused to load the script because it violates the following Content Security Policy directive”
- Where are cookies saved for a local HTML file?
- Use a content script to access the page context variables and functions
- Chrome Extension Message passing: response not sent
- How to launch html using Chrome at “–allow-file-access-from-files” mode?
- “Cannot read property of undefined” when using chrome.tabs or other chrome API in content script
- Export html table data to Excel using JavaScript / JQuery is not working properly in chrome browser
- How to detect page navigation on YouTube and modify its appearance seamlessly?
- Jquery load() only working in firefox?
- “Uncaught TypeError: Illegal invocation” in Chrome
- Injecting JS functions into the page from a Greasemonkey script on Chrome
- Chrome extension: How to remove orphaned script after chrom extension update
- Loading external javascript in google chrome extension
- How to keep Google Chrome Extension popup open?
- Inspecting WebSocket frames in an undetectable way
- Getting unique ClientID from chrome extension?
- Anchor tag download attribute not working :Bug in Chrome 35.0.1916.114
- Bug with Chrome’s localStorage implementation?
- Content-Security-Policy error in google chrome extension making
- Can’t trigger click with jQuery in a Chrome extension
- In a Chrome Extension content script, must I wait for document.ready before processing the document?
- Cross-Origin XMLHttpRequest in chrome extensions
- How to modify current url location in chrome via extensions
- chrome.tabs.executeScript(): How to get result of content script?
- How to develop Chrome extension for Gmail?
- How to to initialize keyboard event with given char/keycode in a Chrome extension?