0

i am trying to create a chrome extension.And i want to include some scripts for the animation purposes.

I created a js file with name "animate.js" like

function ani() {
        // document.getElementById('side-panel').className = 'classname';
        console.log("Animate and close");
}

And in my html file i just added like

<script type="text/javascript" src="animate.js"></script>
<div class="section-title" id="side-panel" align="center">
        <img class="icon-close" onclick="ani()" src="icons/close.png">
        <img src="icons/logo.png" style="height: 35px;">
</div>

Then i tried to run and is showing something like

Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note that hashes do not apply to event handlers, style attributes and javascript: navigations unless the 'unsafe-hashes' keyword is present

Then i added the below line in the manifest.json

"content_security_policy": "script-src 'self' 'unsafe-inline'; object-src 'self'"

But still its showing the same error, How can i fix that

Thanks in advance

Abhi Jith
  • 23
  • 4

0 Answers0