Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Trusted Contributor
gazier20
Posts: 120
Registered: ‎10-25-2010
My Device: Not Specified
Accepted Solution

INVALID_STATE_ERR: DOM Exception 11 ------ XMLHttpRequest -------

Hi,

 

Some of my users have this error : INVALID_STATE_ERR: DOM Exception 11    when they try to do an asynchronous request to our webservice.

 

Theses users are running BOLD 9700 (OS 5.0.0.351).

 

 

function NotificationClient(pId,action) {
    var ajaxRequest;  // The variable that makes Ajax possible!
    var id = 423101774;
    var sem = 301;
    var lang = 1;
    
    if (BBPin == "") // Retrieve pin
        BBPin = espresso.homescreen.pin();

    var url = "https://mywebsite.com/BlackberryNotifications/index.html?PIN=" + BBPin + "&Action=" + action + "&ReceivedNotes=" + pId;  

    try {

        ajaxRequest = new XMLHttpRequest();
    } catch (e) {

        try {
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");            
        } catch (e) {
            try {
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                // Something went wrong
                alert("Your browser broke!");
                return false;
            }
        }
    }

   try {

        ajaxRequest.open("GET", url, true); // true = asynchronous
        ajaxRequest.send(null);
    } catch (ee) {
    alert("Error when notifying : " + ee);
    }

}

 

 

Any idea ?

 

Why only some users have this problem ?

 

Thank you very much for your help

 

 

Please use plain text.
Trusted Contributor
gazier20
Posts: 120
Registered: ‎10-25-2010
My Device: Not Specified

Re: INVALID_STATE_ERR: DOM Exception 11 ------ XMLHttpRequest -------

Any news ? I don't know what to try

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: INVALID_STATE_ERR: DOM Exception 11 ------ XMLHttpRequest -------

I couldn't tell you for sure why you may be getting that error.

 

Do all users using that OS version experience the error? or do only some users experience the error?  

 

If only some get the error on the same OS version number, it makes me start to think about how the device may be set up differently for permissions for the application.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Developer
abarber
Posts: 189
Registered: ‎08-13-2008
My Device: Not Specified

Re: INVALID_STATE_ERR: DOM Exception 11 ------ XMLHttpRequest -------

Hi

 

You may want to try adding a callback function, some devices may have an issue with using async ajax call without a callback.

 

 

Cheers

 

Andrew

Please use plain text.
Trusted Contributor
gazier20
Posts: 120
Registered: ‎10-25-2010
My Device: Not Specified

Re: INVALID_STATE_ERR: DOM Exception 11 ------ XMLHttpRequest -------

I added the callback function. I got the same error.

 

It's very strange.

 

I checked all the permission of the application.It's fine.

 

Any other idea ?

Please use plain text.
Trusted Contributor
gazier20
Posts: 120
Registered: ‎10-25-2010
My Device: Not Specified

Re: INVALID_STATE_ERR: DOM Exception 11 ------ XMLHttpRequest -------

All users are not using the same OS. They all use of 5.0 not 6.0

Please use plain text.
Developer
abarber
Posts: 189
Registered: ‎08-13-2008
My Device: Not Specified

Re: INVALID_STATE_ERR: DOM Exception 11 ------ XMLHttpRequest -------

Hi

 

Just out of interest are you using html_5init.js?

 

if so you may want to try commenting out the "XMLHttpRequest = function() {}"

 

It may be causing issues?

 

Cheers

 

Andrew

 

 

Please use plain text.
Trusted Contributor
gazier20
Posts: 120
Registered: ‎10-25-2010
My Device: Not Specified

Re: INVALID_STATE_ERR: DOM Exception 11 ------ XMLHttpRequest -------

Yes, I use html_5init.js.

 

You are a god, abarber !!!

 

You solved my problem !!

 

I commented the XMLHttpRequest function in the html_5init.js file and it works for one of my users who wasn't able to do the request.

 

I'm going to check with some other users who have the same problem (only a few).

 

 

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: INVALID_STATE_ERR: DOM Exception 11 ------ XMLHttpRequest -------

Very interesting... I'm going to send this along to our Dev/Testing groups to see if we can get the bug fixed

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Trusted Contributor
gazier20
Posts: 120
Registered: ‎10-25-2010
My Device: Not Specified

Re: INVALID_STATE_ERR: DOM Exception 11 ------ XMLHttpRequest -------

I also added this :

 

ajaxRequest.setRequestHeader('Conenction', 'close');

 

I don't think, it was the solution,no ?

 

Please use plain text.