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

**URL:** <https://discourse.mozilla.org/t/my-google-translate-extension-does-not-work-on-github-due-to-cors-how-to-fix/34842>\
**Category:** Development\
**Created:** [January 6, 2019, 4:27pm UTC](https://discourse.mozilla.org/t/my-google-translate-extension-does-not-work-on-github-due-to-cors-how-to-fix/34842 "2019-01-06T16:27:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreip](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/andreip/32/24181_2.png) [@andreip](https://discourse.mozilla.org/u/andreip)\
**Post date:** [January 6, 2019, 4:27pm UTC](https://discourse.mozilla.org/t/my-google-translate-extension-does-not-work-on-github-due-to-cors-how-to-fix/34842/1 "2019-01-06T16:27:33Z")

</div>

Hi all,  
I have this extension [https://github.com/andreicristianpetcu/google\_translate\_this](https://github.com/andreicristianpetcu/google_translate_this)

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

```auto
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

---

<div class="post-metadata">

**Author:** ![freaktechnik](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/freaktechnik/32/37766_2.png) [@freaktechnik](https://discourse.mozilla.org/u/freaktechnik)\
**Post date:** [January 6, 2019, 5:11pm UTC](https://discourse.mozilla.org/t/my-google-translate-extension-does-not-work-on-github-due-to-cors-how-to-fix/34842/2 "2019-01-06T17:11:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![andreip](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/andreip/32/24181_2.png) [@andreip](https://discourse.mozilla.org/u/andreip)\
**Post date:** [January 6, 2019, 5:28pm UTC](https://discourse.mozilla.org/t/my-google-translate-extension-does-not-work-on-github-due-to-cors-how-to-fix/34842/3 "2019-01-06T17:28:39Z")

</div>

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.
