Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-12962

Android: XHR request not working on OS 2.x with SDK 3.0.2 GA

    Details

      Description

      Problem description
      Run the following test case on Android OS 2.x and SDK 3.0.2 GA to find that the XHR request returns "Web page not available". It works fine on later OS versions and SDK 3.0 GA.

      Test case

      var win1 = Titanium.UI.createWindow({
      	title : 'Tab 1',
      	backgroundColor : '#fff',
      	exitOnClose : false
      });
       
      var xhr = Titanium.Network.createHTTPClient({
      	validatesSecureCertificate : false,
      	enableKeepAlive : true,
      	timeout : 10000
      });
      xhr.onerror = function(e) {
       
      };
      xhr.onload = function() {
      	var webview = Titanium.UI.createWebView({
      		html : this.responseText
      	});
      	win1.add(webview);
      };
      xhr.open('GET', "http://google.com/");
      xhr.send();
       
      win1.open();
      

      Solution (baseURL)

      var win1 = Titanium.UI.createWindow({
      	title : 'Tab 1',
      	backgroundColor : '#fff',
      	exitOnClose : false
      });
       
      var xhr = Titanium.Network.createHTTPClient({
      	validatesSecureCertificate : false,
      	enableKeepAlive : true,
      	timeout : 10000
      });
      xhr.onerror = function(e) {
       
      };
      var baseURL = "http://google.com/";
      xhr.onload = function() {
      	var webview = Titanium.UI.createWebView();
      	webview.setHtml(this.responseText, {
      		baseURL : baseURL
      	});
      	win1.add(webview);
      };
      xhr.open('GET', baseURL);
      xhr.send();
       
      win1.open();

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ingo Ingo Muschenetz
                Reporter:
                dsefton Daniel Sefton
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-15812
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration