0

I tried putting the datepicker from https://fengyuanchen.github.io/datepicker/ into my Google Chrome Extension's "popup.html" but I got the below error. My issue was happening due to inpage javascript code.

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-kcRZL8YqMa0qcXAnw/cPs1KPK89FM5025jdMDJBMEwA='), or a nonce ('nonce-...') is required to enable inline execution.

Code for popup.html

<!doctype html>
<html>
<head>
<title>Some Title</title>
<script src="jquery.min.js"></script>
<script src="datepicker.js" type="text/javascript"></script>
<link href="datepicker.css" rel="stylesheet"/>
</head>
<body>
<div style="width:250px">
    <h1>Some Title</h1>
    <input id="calendarDate" data-toggle="datepicker">
    <div id="calendar"></div>
    <br/>
    <button id="checkPage">Start</button>
    <div id="output"></div>
</div>
<script>
$('[data-toggle="datepicker"]').datepicker({
    autoShow : true,
    inline : true,
    container : "#calendar"
});
</script>

0 Answers0