0

I'm writing an extension for mozilla. The manifest.json permission are:

` "permissions": [
    "tabs",
    "activeTab",
    "menus",
    "https://glosbe.com/*",
    "https://*/"  //redundant, just a try 
  ],`

and the background.js:

`function text_translate(){
    var url = "https://glosbe.com/gapi/translate?from=" 
    url += f_lang ;
    url += "&dest=" + t_lang + "&format=json&phrase=";
    url += text;
    $.ajax({
        type: "GET",
        url: url,
        async:true,
        dataType : 'jsonp',   //you may use jsonp for cross origin request
        crossDomain:true,
        success: function(data, status, xhr) {
            alert(data.tuc[0].phrase.text);
        }
    });
}`

But when I run the extension I get this error:

Loading failed for the <script> with source “https://glosbe.com/gapi/translate?from=&dest=&format=json&phrase=fa%20&callback=jQuery33107006632350570763_1519332433684&_=1519332433685”.

and

Content Security Policy: The page’s settings blocked the loading of a resource at https://glosbe.com/gapi/translate?from=&dest=&format=json&phrase=3%20ore%20fa%20&callback=jQuery33103711740868579675_1519334384027&_=1519334384028 (“script-src moz-extension://cff0712a-f5f0-4eff-8dc3-f2dbf5d8da4c”)

With Chrome I haven't got these errors. only with Mozilla Is this error due to a bad configuration of manifest.json or is not possible do what I want?

EDIT I solved the second error with adding a line in manifest.json (`content sicurity polici:[ stuff ..]

2

0

Browse other questions tagged or ask your own question.