get script result chrome.tabs.executeScript
chrome.browserAction.onClicked.addListener(function(tab) {
console.log('Injecting content script(s)');
//On Firefox document.body.textContent is probably more appropriate
chrome.tabs.executeScript(tab.id,{
code: 'document.body.innerText;'
//If you had something somewhat more complex you can use an IIFE:
//code: '(function (){return document.body.innerText;})();'
//If your code was complex, you should store it in a
// separate .js file, which you inject with the file: property.
},receiveText);
});
//tabs.executeScript() returns the results of the executed script
// in an array of results, one entry per frame in which the script
// was injected.
function receiveText(resultsArray){
console.log(resultsArray[0]);
}
Also in JavaScript:
- how to use reduce in javascript
- reactjs app change port
- web worker multiple data
- js num to string with leading 0
- jquery select option by text
- send file discord.js
- replace comma by new line in js
- how do i backspace from javascript calculator
- javascript onsubmit change input value
- datatable dropdown toggle not working
- jquery empecher revoie du formulaire
- text input underline react native
- converting binary to text js
- load a script after a button is pressed js
- checking if a character is an alphabet in js
- merge two strings with alternate characters javascript
- required false jquery
- Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
- js-cookie
- react hooks update nested object
- unterminated character class react native
- how to query chain an id in an id javascript
- mysql json_extract remove quotes
- event handler attachment jquery