1
    <!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?
family=Ubuntu">
    <script src="js/jquery-3.2.1.js"></script>
    <script lang="javascript">

    $.post("https://min-api.cryptocompare.com/data/price?
fsym=ETH&tsyms=BTC,USD,EUR,GBP", function(eth) {
    $('.eth').html(" The current Ethereum exchange rates are : <br> ₿ BTC = 
"+ eth.BTC + " <br>      $ USD= " + eth.USD + " <br>    £ GBP = " + 
eth.GBP);
    })
    </script>

This code works perfectly in its own html file but will not work at all when I open it as a chrome extension

I get this error in dev tools:

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'sha256-oFzBi9JZskUI5CKNOzVT1pIdO1IDvpoDY641Phtabik='". Either the 'unsafe-inline' keyword, a hash ('sha256-FmO81S18lWLAR5YjfqWZQYd+9BUG7eDZqh3Ax5qqR0U='), or a nonce ('nonce-...') is required to enable inline execution.

I then did this in the manifest but it did nothing: "content_security_policy": "script-src 'self' 'sha256-FmO81S18lWLAR5YjfqWZQYd+9BUG7eDZqh3Ax5qqR0U='",

sideshowbarker
  • 62,215
  • 21
  • 143
  • 153

0 Answers0