You need to use this query to send data to DOM from the current tab being viewed.
chrome.tabs.executeScript(null, {
code: 'var config = ' + JSON.stringify(getKeywords)
}, function() {
chrome.tabs.executeScript(null, {file: 'custom.js'});
});
and in the custom.js
file you can write you function that you want to apply on the DOM element. like if you want to hide something than you need that query in custom.js
. So if you wanted to use that example you would need to modify it according to your requirements.
var all = document.getElementsByTagName("div");
var searchValue=config.toString().split(',');
alert('Example:' + searchValue[0]);
for(j=0; j < searchValue.length; j++) {
for(i=0; i < all.length; i++) {
if(all[i].innerHTML.indexOf(searchValue[j]) > -1){
all[i].innerHTML = ""
}
}
}