Reputation: 22681
I am trying to build my first chrome extension, I have a problem where only first content script is being loaded. This is what I have defined in manifest.json
"content_scripts": [
{
"matches": ["http://www.facebook.com/connect/login_success.html*"],
"js": ["prototype.js", "intercept.js"]
}]
}
When I see the scripts loaded on this page,
I see only prototype.js loaded. Any idea ?
Upvotes: 0
Views: 285
Reputation: 7663
Actually, scratch all of this. I got it working now with no apparent changes on my end. When you inject a script, however, you shouldn't be able to see it in the DOM IIRC. Is it possible you just have a stray typo that's causing it to not render? You might want to test it on other pages.
Unless it was Chrome pushing some random update that fixed things (possible), I'm thinking it might just have to do with intercept.js.
I will still give Facebook a ton of credit for using a strict doctype and failing to validate with only one word, though.
Initial answer (preserved only to demonstrate my confusion)
I was able to duplicate your result with the simplest scripts possible, which I got working on other pages. The issue might have something to do with the doctype, XHTML Strict, and the fact that -- despite the page managing to contain only a single word -- it doesn't validate. I tried several methods of dealing with it:
content_scripts.run_at
to "document_end"
in manifest.jsonchrome.tabs.executeScript
to inject a scriptchrome.tabs.executeScript
to inject pure codechrome.tabs.executeScript
to inject a script with the code surrounded in CDATA tagschrome.tabs.executeScript
to inject pure code surrounded in CDATA tagsNone worked.
Upvotes: 2