Reputation: 9643
This is my manifest:
{
"name": "rabbi",
"version": "1.0",
"description": "something",
"browser_action": {
"default_icon": "icon.png",
"popup": "popup.html"
},
"content_scripts": [ {
"js": ["jquery-1.7.1.min.js", "rabbi.js"],
"matches": [ "http://*.facebook.com/*", "http://facebook.com/*", "https://*.facebook.com/*", "https://facebook.com/*" ],
"run_at": "document_end"
} ],
"permissions": [ "contextMenus", "tabs", "http://*.facebook.com/*", "http://facebook.com/*", "https://*.facebook.com/*", "https://facebook.com/*" ]
}
and rabbi.js:
<script type="text/javascript">
$(document).ready(function(){
alert("Thanks for visiting!");
});
</script>
But a message "Thanks for visiting" never pops up when I enter facebook.
Upvotes: 3
Views: 734
Reputation: 8131
You are injecting a script, not a html document. So you don't need the <script type="text/javascript"></script>
tag.
as a side note: With the property "run_at": "document_end"
your script is injected when the DOM is completely constructed. Which is in fact at the same time $(document).ready
fires. This means you don't necessarily need to wrap your code inside this function.
Upvotes: 1
Reputation: 13332
you specified that you should run your script at "run_at": "document_end"
this is after the dom ready event has fired (so you don't need it)
Upvotes: 1
Reputation: 47833
rabbi.js
is a JavaScript file so you can remove the HTML.
$(document).ready(function(){
alert("Thanks for visiting!");
});
Upvotes: 0