google-translate

add a Google Translate plug-in to the page

La data de 25-04-2024. Vezi ultima versiune.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Autor
pansong291
Rating-uri
0 0 0
Versiune
0.2
Creat
25-04-2024
Actualizat
25-04-2024
Size
3,02 KB
Licență
Apache-2.0
Se aplică pe
Toate site-urile

在网页左下角嵌入一个 Google 翻译小部件。

部分网页由于 CSP 限制无法正常加载翻译部件

一些网站会设置 CSP 限制,导致不能在页面上加载其他来源的 script 脚本,比如 Github

这时控制台会出现如下的报错:Refused to load the script 'https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit' because it violates the following Content Security Policy directive: ...

解决办法

  1. 安装 Header Editor 这个浏览器插件,根据你使用的浏览器选择不同的版本:
  2. 在 Header Editor 插件中新增一条规则。名称移除 CSP 响应头规则类型修改响应头匹配类型全部执行类型常规头名称content-security-policy头内容_header_editor_remove_,最后点击 保存
  3. 最后记得启用 Header Editor,然后刷新页面即可。