I need to get some data from an RSS feed for at Chrome Extension. I'm attempting to use jQuery to do so.
Inspecting popup shows:
- Uncaught ReferenceError: $ is not defined - popup.js:5
- Refused to load the script 'http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.0.min.js' because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". - popup.html:1
This is the code:
popup.js
(function () {
alert("Function running"); //Fired
$(document).ready(function (e) {
$.get("https://fupifarvandet.dk/episodes.rss", function (data) {
$(data).find("item").each(function () {
var el = $(this);
console.log("------------------------");
console.log("title : " + el.find("title").text());
alert(el.find("title").text());
alert("Inside the function"); //Never fired
});
});
});
alert("Function has run"); //Never fired
})();
manifest.json
{
"manifest_version": 2,
"name": "RSS Read test",
"description": "Extension description",
"version": "1.0",
"browser_action": {
"default_icon": "img/icon.png",
"default_popup": "popup.html"
}
}
popup.html
<!doctype html>
<html>
<head>
<title>Getting Started Extension's Popup</title>
<style>
</style>
<script src="popup.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.0.min.js"></script>
</head>
<body>
</body>
</html>