What I'm trying to do
It's an extension that, once the page loads, hides a div
that contains a child with class 'example'.
What happens
Nothing. On the js
page anything that I place is ignored. I have tried using the console and creating page alerts but nothing will work.
Code
manifest.json
:
{
"name": "Example",
"version": "1.0",
"default_locale": "en",
"permissions": [
"http://example.com/*"
],
"content_scripts": [
{
"matches": [
"http://example.com/*"
],
"js": [
"js/jquery/jquery.js",
"src/inject/inject.js"
]
}
]
}
src/inject/inject.js
:
chrome.extension.sendMessage({}, function(response) {
var readyStateCheckInterval = setInterval(function() {
if (document.readyState === "complete") {
clearInterval(readyStateCheckInterval);
//Nothing here actually happens
alert("Extension loaded");
console.log("Extension loaded");
//The script that I *want* to happen
$('.example-stamp').parent().parent.().parent().hide();
}
}, 10);
});
Notes
The jquery.js
file is the latest download from jQuery.com. There are no errors when loading the unpacked extension into Chrome, and nothing - not even errors - appear in the console.
I have been testing it on http://www.example.com
.