My Google translate extension does not work on Github due to CORS. How to fix?


(Andrei Petcu) #1

Hi all,
I have this extension https://github.com/andreicristianpetcu/google_translate_this

It does not work in github. I get this error:

Content Security Policy: Setările paginii au blocat încărcarea unei resurse la https://translate.googleapis.com/translate_static/css/translateelement.css („style-src”).
Content Security Policy: Setările paginii au blocat încărcarea unei resurse la https://translate.googleapis.com/translate_static/js/element/main_ro.js („script-src”). 

How an I fix?
Thank you


(Martin Giger) #2

Are you trying to load these scripts and styles as normal page level scripts/stylesheets? If yes, you either modify the CSP of pages you want to inject them into, don’t insert them as remote scripts and instead insert them using the content script/execScript APIs or hope that Firefox will one day allow things inserted by extensions to circumvent the CSP of a page.


(Andrei Petcu) #3

Modifying the headers of all the pages I load seems really tricky. If I provide the Google JS locally I think I make a copyright infringement.