Closed lucaspessivaldo closed 2 years ago
No, this is not an error with this package, this is an intended feature of browsers called the Same-Origin Policy. It is critical for protecting sensitive user information. From a normal webpage context it is not possible to use this package, it can be used from a a browser extension background script or an Electron project though.
For an example of usage in a browser extension see here
Thankst to answer, I'll check it.
I'm using ReactJs. When I use the request example. I'm getting CORS error.
That code return
Access to fetch at 'https://translate.google.com/' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Is that an API error or I need to use some param on the request
translate()
?