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

New Member
Posts: 1
Registered: ‎06-20-2011
My Device: Bold 9000
My Carrier: Vodafone

XmlHttpRequest local file

Hi, I'm trying to use an offline html file on the Blackberry Bold 9000 to access a simple text file (also held locally on the SDCard) using XmlHttpRequest but keep getting a DOMException. Could anyone suggest how I might make this work? It never gets past the open() call. Many thanks.




function getDataFile(filepath) {

alert("Trying to read: " + filepath)

request = new XMLHttpRequest();

try {

request.open('GET', filepath, true);

request.onreadystatechange = handleFileResponse; 



catch (e) {




function handleFileResponse() {

if (request.readyState == 4) {





Posts: 14
Registered: ‎10-08-2010
My Device: 9700
My Carrier: Rogers

Re: XmlHttpRequest local file

This is what I did:


var xhr = new XMLHttpRequest();

    // Register the embedded handler function
      xhr.onreadystatechange = function () {
        if (xhr.readyState == 4 && xhr.status == 200) {
          var result = xhr.responseText;
          //do your work here
      xhr.open("GET", "file:///store/home/user/abc.html");



I hope this helps.