sienori / simple-translate

WebExtensions for translating text on web pages
http://simple-translate.sienori.com/
Mozilla Public License 2.0
1.12k stars 126 forks source link

Access-Control-Allow-Origin error #259

Open qxy-online opened 3 years ago

qxy-online commented 3 years ago

Error: please check your network connection status

[debug] common/translate: tranlate() repository zh-CN content.js:1 [debug] common/translate: sendRequest() simple-translate:1 Access to XMLHttpRequest at 'https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=zh-CN&dt=t&dt=bd&dj=1&q=repository' from origin 'https://github.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. content.js:1 [error] common/translate: formatResult() {resultText: "", candidateText: "", sourceLanguage: "", percentage: 0, statusText: "Network Error"} (anonymous) @ content.js:1 (anonymous) @ content.js:22 t.a @ content.js:22 async function (async) t.a @ content.js:22 h @ content.js:22 (anonymous) @ content.js:22 async function (async) (anonymous) @ content.js:22 handleTextSelect @ content.js:22 componentDidMount @ content.js:22 Gi @ content.js:22 Yi @ content.js:22 qi @ content.js:22 Ki @ content.js:22 $i @ content.js:22 xi @ content.js:22 ol @ content.js:22 ll @ content.js:22 hl.render @ content.js:22 (anonymous) @ content.js:22 tl @ content.js:22 vl @ content.js:22 render @ content.js:22 P @ content.js:22 b @ content.js:22 async function (async) b @ content.js:22 content.js:1 [debug] common/translate: tranlate() repository zh-CN content.js:1 [debug] common/translate: sendRequest() content.js:22 GET https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=zh-CN&dt=t&dt=bd&dj=1&q=repository net::ERR_FAILED (anonymous) @ content.js:22 t.a @ content.js:22 h @ content.js:22 (anonymous) @ content.js:22 async function (async) (anonymous) @ content.js:22 handleTextSelect @ content.js:22 componentDidMount @ content.js:22 Gi @ content.js:22 Yi @ content.js:22 qi @ content.js:22 Ki @ content.js:22 $i @ content.js:22 xi @ content.js:22 ol @ content.js:22 ll @ content.js:22 hl.render @ content.js:22 (anonymous) @ content.js:22 tl @ content.js:22 vl @ content.js:22 render @ content.js:22 P @ content.js:22 b @ content.js:22 async function (async) b @ content.js:22 simple-translate:1 Access to XMLHttpRequest at 'https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=zh-CN&dt=t&dt=bd&dj=1&q=repository' from origin 'https://github.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. content.js:1 [error] common/translate: formatResult() {resultText: "", candidateText: "", sourceLanguage: "", percentage: 0, statusText: "Network Error"} (anonymous) @ content.js:1 (anonymous) @ content.js:22 t.a @ content.js:22 async function (async) t.a @ content.js:22 h @ content.js:22 showPanel @ content.js:22 handleTextSelect @ content.js:22 async function (async) handleTextSelect @ content.js:22 componentDidMount @ content.js:22 Gi @ content.js:22 Yi @ content.js:22 qi @ content.js:22 Ki @ content.js:22 $i @ content.js:22 xi @ content.js:22 ol @ content.js:22 ll @ content.js:22 hl.render @ content.js:22 (anonymous) @ content.js:22 tl @ content.js:22 vl @ content.js:22 render @ content.js:22 P @ content.js:22 b @ content.js:22 async function (async) b @ content.js:22 content.js:22 GET https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=zh-CN&dt=t&dt=bd&dj=1&q=repository net::ERR_FAILED

qxy-online commented 3 years ago

https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=zh-CN&dt=t&dt=bd&dj=1&q=repository

访问这个路径后得到了谷歌服务器返回的请求:

`我们的系统检测到您的计算机网络中存在异常流量。请稍后重新发送请求。 如果 Google 自动检测到从您的计算机网络发出的请求可能违反服务条款,就会显示此网页。这些请求一旦停止,此阻断即会失效。

该流量可能是由恶意软件、浏览器插件或发送自动请求的脚本发出的。如果您与他人共享网络连接,请向管理员寻求帮助 — 这可能是由多台计算机使用同一 IP 地址导致的。了解详情

有时,如果您使用的是自动程序普遍使用的高级条款或者正在快速连续地发送请求,则可能会出现此网页。`

sienori commented 3 years ago

Deleting the cookies related with Google Translate may help. image

alexeyp0708 commented 3 years ago

There is a problem. It occurs due to the fact that the application sends a lot of requests to Google Translate, as a result of which Google bans access. To solve it: