Phonegap Blackberry 5 cross-domain communication

536 views Asked by At

I tested my app on OS6 and OS7 devices, both worked well. But a few days ago, I faced an issue on OS5 devices. All Ajax requests didn't work. After some googling, I found out that in OS5, ajax is disabled. It is so weird, My app must work on OS5 devices but I can't make Ajax call.

To fix this issue, I searched about old cross-domain methods and found 'dynamic scripting' and 'IFrame' methods. Here is an article describes them :

http://www.openjs.com/articles/ajax/transfer_methods_xmlhttprequest_alternatives.php

But I have no example about non xmlHttpRequest or non ActiveX methods. Is there anybody who has a working example about these methods. I have a jsp file on the server that sends me a xml response.

a working example will make me so grateful.

Thanks in advance.

[EDIT]

I decided to use IFrame to cross-side communication, but unable to get content of iFrame, my code is like that :

function onIFrameLoad(i) {
    var response;
    if(i.contentDocument){
        response = i.contentDocument; // For NS6
    }else if(i.contentWindow){
        response = i.contentWindow.document; // For IE5.5 and IE6
    }
    var parser = new PListParser();
    var result = parser.parsePList(response);   
    ....
}

and

<iframe id="iFrame" onload="onIFrameLoad(this);" src="[a url]"></iframe>

this works well in Ripple Emulator but doesn't work on real device(os5).

1

There are 1 answers

0
Arturo Moncada-Torres On

Do you have access to the server where you are fetching the data? If you do, maybe you could configure it to fetch the data as a JSONP.