user1268879
user1268879

Reputation: 25

Opera Extension xmlhttp.send(); error

I am having a problem connecting to a java application using my opera extension I already did this extension in chrome a it work.

this is the code in javascritp in the popup.html

function AtribuirID(){

    if (window.XMLHttpRequest)
    {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }

    xmlhttp.onreadystatechange = function()
    {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
            var texto = xmlhttp.responseText;
            var splitagem=texto.split("(user)"); 
            localStorage.setItem('ID',splitagem[0]);
            localStorage.setItem('Auxiliar',splitagem[1]);
        }
    }

    xmlhttp.open("GET","http://localhost:10002?z=AtribuirID",true);
    xmlhttp.send();
}

The problem is that i am getting a error Uncaught exception: DOMException: NETWORK_ERR in xmlhttp.send() and i cant access my application in java that suppose to be the server part. I have already put the network="public private" in the config.xml but it didnt work

Upvotes: 2

Views: 1240

Answers (1)

ALEX ORTIZ
ALEX ORTIZ

Reputation: 189

in config.xml file add this line: <access origin="*" subdomains="true"/> to allow any domain httprequest before </widget> tab, this solve the problem, if problems persist, open in opera browser tab "opera:config" and select "Users Prefs" and check "Allow File XMLHttpRequest" and restart. if have problem i can send you my opera extension working fine...

Upvotes: 7

Related Questions