ajax xhr.getResponseHeader("user header") is not working for Android native browser

373 views Asked by At

I am trying to make an AJAX call to a servlet. In the servlet I am setting headers. But the header is not displayed back from the response in the Android native browser. I am not able to read the header. In other browsers it is working fine.

javascript code:

$.ajax({
    type: 'GET',
    url: url,
    cache : false,
    async: false,
    success: function(data, status, xhr) {
        code = xhr.getResponseHeader('X-code');
    }
});

I am taking care or CORS issues.

response.addHeader("Access-Control-Allow-Origin", "*");
response.addHeader("Access-Control-Request-Method", "*");
response.addHeader("Access-Control-Allow-Headers", "X-code");
response.addHeader("Access-Control-Expose-Headers", "X-code");

Things are working fine for other mobile/web browser, but not working for Android native browser.

Need assistance.

Thanks in advance.

0

There are 0 answers