Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7718471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:10:37+00:00 2026-06-01T03:10:37+00:00

I am developing a BlackBerry Phonegap application. Therefore, I am using JavaScript. From a

  • 0

I am developing a BlackBerry Phonegap application. Therefore, I am using JavaScript.

From a local file, I am trying to fetch some data (bare text) located in the server. I am trying in different browsers (Mozilla and Chrome mainly). The code I am using is as follows:

try{
    request = new XMLHttpRequest();
    request.onreadystatechange = processResults;
    request.open('GET', url, false);
    request.send();
}catch(e){
    alert('exception performing data request: ' + e.name + '; ' + e.message);
}

And the callback:

function processResults(){
    if(request.readyState == 4){    
        if(request.status == 200){
            document.getElementById('divResults').innerHTML = request.responseText;
        }else{
            alert("Error! Status" + request.status + " - " + request.statusText); 
        }
    }
}

The problem I am having is that data is never fetched. The exception returns the following error:

NS_ERROR_FAILURE; Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)

I did some research and the most common cause of these problems is the Same-Origin Policy. However, I am sure to disable it before:

try {  
    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");  
} catch (e) {  
    alert("UniversalBrowserRead failed");  
}   

Firebug just points that the error is in the request.send() line, but gives no further information. The xmlHTTP status is 0, although no request.statusText is displayed. What am I doing wrong? Thanks in advance 🙂 .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:10:38+00:00Added an answer on June 1, 2026 at 3:10 am

    The solution was to test the application in Internet Explorer, believe it or not. In IE, no error messages appeared and everything worked as expected. After many tests, this is the code that worked for me. Hope it is useful for someone else:

    // Create the XHR object.
    // For non-IE browsers (Chrome, Mozilla, Opera, Safari, etc.).
    if(XMLHttpRequest){
        request = new XMLHttpRequest();
    // For IE.
    }else if(ActiveXObject){
        try{
            request = new ActiveXObject('Msxml2.XMLHTTP');
        }catch(e){
            request = new ActiveXObject('Microsoft.XMLHTTP');
        }
    }else{
        alert('Could not create XMLHTTP request object');
    }
    
    // Request the data.
    try{
        request.onreadystatechange = function(){
            if(request.readyState == 4 && request.status != 200){
                console.log(request.responseText);
                alert("Error! Status " + request.status + " - " + request.statusText); 
            }
        };
        request.open('GET', targetURL, false);
        request.send();
    
    }catch(e){
        alert('Error while performing the request: ' + e.name + '; ' + e.message);
    }
    
    // Empty the content into a proper JavaScript variable.
    var text = request.responseText;
    var xmlText = eval("(" + text + ")");
    // Just fetch the data you want from the xmlText object.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing BlackBerry 5.0 application with list organized data. I'm using ObjectListField and manual
I am developing blackberry application using BlackBerry JDE 5.0.X , in which i am
I am developing a blackberry application and i wanted to access the websites from
I am developing a blackberry application using j2me and LWUIT (blackberry port). Everything works
I am developing a BlackBerry app which needs to read from an xml file.
I am developing one Blackberry application using Eclipse, I need to show images in
I'm developing an application using the Blackberry plugin for eclipse and I am getting
I'm developing an app for Blackberry on OS 5. I'm trying to have some
i am developing application in blackberry and i m using eclipse.in my app there
I'm developing a blackberry application to remotely access an external customer database. Selected employees

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.