How to suppress SSL error when an AJAX request to a server with an invalid certificate

I have this code:

function newXMLHttpRequest() {
    var xmlHttp;
    try {
        xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (f) {
            xmlHttp = new XMLHttpRequest();
        }
    }
    return xmlHttp;
}
var xmlHttp = newXMLHttpRequest();
xmlHttp.open("POST", url, true);
xmlHttp.onreadystatechange = function() {
    // this I have xmlHttp.status = 12019        
    alert("readyState = " + xmlHttp.readyState + "\nstatus = " + xmlHttp.status);
}
xmlHttp.send('same data');

When I send a request to a server with an invalid certificate, I have an error with status 12019.

The solution should be cross-browser (IE, FF, Chrome)

+5
source share
1 answer

Firstly, to answer the question in the title, this is not possible. The xmlHttp client libraries do not allow the client to ignore ssl errors. The object MsXml2.ServerXMLHTTP allows you to ignore SSL errors using the setOption(2, 13056) method . However, this object cannot be used in a browser and is not cross-platform.

, , . 12019 . HTTP 403 .

12019 :

ERROR_INTERNET_INCORRECT_HANDLE_STATE

12019

, .

, , , , IE , . . , IIS , , , , . .

+1

All Articles