0

I have written a javascript which requests a text to my http://localhost/fileread.php and put the response into a textarea in a website with https:// connection (https://translate.google.com/). Since I'm taking some content from http website to a https website, firefox doesn't allow me to do so because of the mixed content policy. So I turned off the bit for security.mixed_content.block_active_content to false in about:config. Now the normal firefox just gives a warning and allows me to copy the content into that textarea.

But I want to use this script in my firefox developer edition because of security reasons. I do the same and allow the mixed content in about:config. But the ajax request to fetch the content from my localhost fails. Here is the code snippet:

function getFileContent(name){
    $.ajax({
        type: "post",
        url: "http://localhost/fileread.php",
        crossDomain: false,
        data: {"file":name},
        beforeSend: function(){},
        success: function(responseData, textStatus, jqXHR) {
             document.getElementById('textarea').innerHTML = responseData;
             //document.getElementById("gt-submit").click();
             DownloadFile(name);
        },
        error: function(jqXHR, textStatus, errorThrown) {
            console.log("Ajax request failed");
            console.log(errorThrown);
        }
    });
}

It works in the normal firefox but it fails in the developer edition with errorThrown = undefined. I don't have any idea if it is a problem of jQuery or mixed content. How to get it work in developer edition?

P.S. : The script works fine over http websites (http://www.bing.com/translator) in both normal and developer edition. Also, it is a valid solution to setup the web server to use https in this case, but I tried that and failed miserably. So that's not an option for me.

Community
  • 1
  • 1
Chirag Soni
  • 37
  • 1
  • 7

0 Answers0