48
rated 0 times
[
55]
[
7]
/ answers: 1 / hits: 44528
/ 12 Years ago, thu, may 10, 2012, 12:00:00
I'm trying to get my Chrome Extension to inject some javascript with content_scripts
, using this previous answer as a reference.
manifest.json
name: My Chrome Extension,
version: 1.0,
manifest_version: 2,
content_scripts: [{
matches: [http://pagetoinject/script/into/*],
js: [contentscript.js]
}]
contenscript.js:
var s = document.createElement('script');
s.src = chrome.extension.getURL(script.js);
(document.head||document.documentElement).appendChild(s);
s.parentNode.removeChild(s);
( also tried this method with no success. )
var s = document.createElement('script');
s.src = chrome.extension.getURL(script.js);
s.onload = function() {
this.parentNode.removeChild(this);
};
(document.head||document.documentElement).appendChild(s);
I keep getting this javascript error. Here's a screenshot.
GET chrome-extension://invalid/
(anonymous function)
More From » jquery