tesseract.js
tesseract.js copied to clipboard
Reopen the question: will tesseract.js support chrome extension build with MV3
The problem now of using tesseract.js in chrome extension with manifestV3 is the unsafe-eval issue. As MV3 separate the CSP for extension page and sandboxed page, the extension page is no longer allow to use unsafe-eval in script-src. May I ask is there any example or method to implement tesseract.js in chrome extension with manifestV3?
Any updates on this issue? Looks like chrome are allowing us to set worker-src in the csp for extension_pages. According to this bug here Chrome allowing worker-src link however when using this with tesseract.js in the extension, csp throws an error relating to loading blob url's in the worker. This bug can be seen here Blob: url bug with mv3 and tesseract
@jeromewu @ForeverAT
currently no, I have changed to other OCR for my project in this moment. @clarodanesh
Hello! any update on this issue . any idea how to make this work using manifest version 3 ?
I'm the only active maintainer at the moment, and have no experience with developing Chrome extensions. Therefore, I think this would take somebody else developing a fix, or at the very least, providing a detailed description of what part of tesseract.js is problematic and how it would need to be changed.
Actually I find a method ( and tried) these days, you may inject the file into the website you are browsing and build worker in the website. Most websites are fine but like GitHub, it does not allowed us to create worker (which does not required by other OCR technology). Hope this help you guys. @sanjeev07 @clarodanesh
Hey @Balearica,
At @ForeverAT is correct. That is the way i'm able to get it to work.
The more detailed issue is that the Manifest v3 switches the backend script to the serverworker standard and you no longer have access to the document api.
Let me know if I can do anything, as it would be amazing to have the tesseract in the serverworker.
@ForeverAT I was able to add it to Chrome Extension (running in an extension popup page), explained here: https://stackoverflow.com/a/76604454/653457. No idea why there is no documentation/mention of this anywhere though.
@datvm thank you, at least I'm getting a new error now:
Refused to compile or instantiate WebAssembly module because neither 'wasm-eval' nor 'unsafe-eval' is an allowed source of script in the following Content Security Policy directive: "script-src 'self'"). Build with -s ASSERTIONS=1 for more info.
@felri You need to add a CSP declaration for wasm.