Tengo un complemento de Gmail que ha dejado de funcionar en Google Chrome. Pero funciona bien en Firefox.
El comportamiento esperado es que, cuando presiono un botón, hago una llamada a la API y cuando responde, se debe abrir una nueva ventana.
Este es mi código:
if(url) { return CardService.newActionResponseBuilder() .setOpenLink( CardService.newOpenLink().setUrl(url) ) .build(); }Este es el error que aparece en la consola de Chrome cuando presiono el botón:
Refused to run the JavaScript URL because it violates the following Content Security Policy directive: "script-src 'nonce-ZdWSj0kAoeg10RRDcE282g' 'self' https://apis.google.com https://ssl.gstatic.com https://www.google.com https://www.gstatic.com https://www.google-analytics.com". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note that hashes do not apply to event handlers, style attributes and javascript: navigations unless the 'unsafe-hashes' keyword is present.Ok, solucioné este problema reemplazando setOnClickOpenLinkAction(action) con este setOnClickAction(action)
Ahora está funcionando en Chrome y Firefox.