Skip to content

Possible CORS error when trying to utilize package in angular project #66

Answered by robertknight
bee-mcc asked this question in Q&A
Discussion options

You must be logged in to vote

It looks to me like the web page is being loaded from http://localhost:8080, but the scripts on the page are being served from a file:// URL. Due to browser security restrictions, the tesseract-worker.js file needs to be served from the same origin (the "http://localhost:8080" part of the URL) as the web page itself.

By default the URL of tesseract-worker.js is determined from the URL of the JavaScript bundle that the OCRClient class has been packaged into. However you can override it using the workerURL option: new OCRClient({ workerURL: 'http://localhost:8080/path/to/tesseract-worker.js' }). There is also a wasmBinary option which you can use to specify he path to the .wasm files.

Replies: 5 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@bee-mcc
Comment options

Answer selected by bee-mcc
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants