anki-add-hooks-userscripts icon indicating copy to clipboard operation
anki-add-hooks-userscripts copied to clipboard

Google Translate broken: "Add" button not appearing

Open DavidFernandezBonet opened this issue 4 years ago • 1 comments

Your software

  • OS: Windows 10
  • Browser: Chrome
  • Extension: Tampermonkey

Describe the bug The add button stopped appearing not long ago without having changed anything about my set-up. I have been using Google Translate. I am running updated version of browser/extension.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'translage.google.com'
  2. Open Anki Desktop
  3. Translate a word
  4. Anki "Add" button does not appear.

Expected behavior Anki "Add" button should appear

Screenshots image

DavidFernandezBonet avatar Sep 20 '21 16:09 DavidFernandezBonet

The console shows the following error: This document requires 'TrustedHTML' assignment.

It seems that Google Translate made its CSP more restrictive. This is probably due to the answer's header:

content-security-policy: require-trusted-types-for 'script'

On Firefox I get similar error:

Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”).

For now I unfortunately do not have a solution. It is likely that it affects any userscript trying to run on Google Translate.

In addition I do not have a sufficient knowledge of CSPs to figure out whether there can be a workaround.

So wait and see... (suggestions and PR welcome!)

OoDeLally avatar Sep 21 '21 21:09 OoDeLally