I encountered this issue while checking the console.
The Content Security Policy on the page is blocking a resource from loading at self ("script-src app://fa91d835-176d-4fe7-bd06-fe7f57f11b68").
As part of creating a Firefox AJAX app to fetch data from my CodeIgniter controller, I added a JavaScript function in an external file. However, when I inspect the console, only the CSP error is displayed.
This is the code from my Index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Privileged app</title>
<meta name="description" content="A privileged app stub">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="css/app.css">
<script type="text/javascript" src="js/app.js" ></script>
<script type="text/javascript" src="js/jquery-1.7.1.min.js" ></script>
<script type="text/javascript" src="js/xhrapp.js" ></script>
<link rel="prefetch" type="application/l10n" href="data/locales.ini" />
<script type="text/javascript" src="js/libs/l10n.js" ></script>
</head>
<body>
<section>
<h1 data-l10n-id="app_title">Privileged empty app</h1>
<p data-l10n-id="app_description">This app is empty. Fill it with your own stuff!</p>
<p id="message"></p>
<input type="text" id="ajax_data" value="">
<a href="" onclick="xhrapp();"><button>Click</button></a>
</section>
</body>
</html>
Check out the xhrapp.js function below:
function xhrapp(){
var a=$("#ajax_data").val();
alert(a);
console.log("in function");
var xhr = new XMLHttpRequest({
mozSystem: true
});
// xhr.open("POST", "http://blac.byethost7.com/home/index.php/welcome/demo");
xhr.open("POST", "http://localhost/shop/home/home/demo");
xhr.send(a);
xhr.onload = function() {
if (xhr.status == 200) {
console.log(xhr.responseText);
// alert(xhr.responseText);
}
};
}
If anyone has any suggestions or solutions, please feel free to provide your assistance. Thank you!