Reputation: 76
I am trying to make a chrome extension that takes screenshots and the idea is to pass it through tesseract.js
But while I am using CDN script tag
<script src='https://unpkg.com/[email protected]/dist/tesseract.min.js'></script>
I am getting this error: error.png
Refused to load the script 'https://unpkg.com/[email protected]/dist/tesseract.min.js' because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem:". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
Any suggestion what I need to do? I dont want to use npm method.
Do I need to add content_security_policy
to my manifest.json file? If Yes, then what?
Upvotes: 0
Views: 733
Reputation: 1
Refer the screenshot from manifest.json
You can use the tesseract.min.js file as the content script in manifest.json. Now, perform the Tesseract related tasks in the separate content.js file which is invoked on click of the button in popup.html.
Since we are using tesseract file as the content script hence the tesseract variables are available for the invoked content script and hence we can successfully perform all the tesseract related operations in this file.
Upvotes: 0