I'm trying to get the innerText
of the current opened tab in a chrome extension.
Here's my manifest.json:
{
"manifest_version": 2,
"name": "meow",
"description": "meow-meow-meow",
"version": "1.0",
"browser_action": {
"default_icon": "icon2.png",
"default_popup": "popup.html"
},
"background": {
"scripts": ["background.js"]
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["contentscript.js"]
}
],
"permissions": [
"http://*/*",
"https://*/*",
"contextMenus",
"tabs"
]
}
Here's my contentscript.js:
function getText(){
return document.body.innerText
}
console.log(getText());
But it isn't logging anything on the console! What am I missing?
EDIT: Is there a better way to get the HTML content from the current tab?
UPDATED EDIT:
This runs fine on my friend's chrome, but not on mine, both Chrome versions are 26.
Thank you!