Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-7150

Error when using ajax on local file with Windows Phone

    XMLWordPrintableJSON

Details

    Description

      I have created a jquery mobile (1.4.3) app using phonegap build. It uses ajax get to load a local html file into a variable that I then inject into the body of the document. This happens by user selection long after device ready.

      This works well with Android and iOS but comes up with an error on Windows Phone 8

      On my config.xml I have allowed for CORS
      <access origin="*" />

      Also in the startup of the app I have:
      $(document).bind("mobileinit", function(){
      $.extend( $.mobile ,

      { ajaxEnabled: false }

      );
      $.support.cors = true;
      $.mobile.allowCrossDomainPages = true;
      });

      There is no error code returned, just the status of error. And the jqXHR.responseText is empty. The URL looks fine.

      $.ajax({
      type: 'get',
      url: url,
      dataType:"html",
      beforeSend: function(jqXHR, settings)

      { jqXHR.url = settings.url; }

      })
      .done( function(data) {
      $("#phone_frame .ui-content").html(data);
      $(':mobile-pagecontainer').enhanceWithin();
      $(':mobile-pagecontainer').pagecontainer('change', '#phone_frame',

      { transition: 'slide', changeHash: true, showLoadMsg: true }

      );
      }) // done
      .fail(function(jqXHR, status, err){
      $.mobile.loading('hide');
      alert("Status:"status", error code:"+err);
      });

      Attachments

        Activity

          People

            purplecabbage Jesse MacFadyen
            aesculus Chris Couper
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: