<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Error with XMLHttpRequest () in IOS app. in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052334#M50526</link>
    <description>&lt;P&gt;I developed a HTML5 app in XDK reading from a local XML file. In the emulator it works properly, and built on android app as well, but the test does not work ios.&lt;BR /&gt;
	access to the XML file is done with a call:&lt;BR /&gt;
	Connect var = new XMLHttpRequest ();&lt;BR /&gt;
	Connect.open ("GET", "data /archivename.xml file", false);&lt;BR /&gt;
	Connect.setRequestHeader ("Content-Type", "text / xml");&lt;BR /&gt;
	Connect.send (null);&lt;/P&gt;

&lt;P&gt;What is the problem?&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2015 10:29:58 GMT</pubDate>
    <dc:creator>pedro_v_</dc:creator>
    <dc:date>2015-09-29T10:29:58Z</dc:date>
    <item>
      <title>Error with XMLHttpRequest () in IOS app.</title>
      <link>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052334#M50526</link>
      <description>&lt;P&gt;I developed a HTML5 app in XDK reading from a local XML file. In the emulator it works properly, and built on android app as well, but the test does not work ios.&lt;BR /&gt;
	access to the XML file is done with a call:&lt;BR /&gt;
	Connect var = new XMLHttpRequest ();&lt;BR /&gt;
	Connect.open ("GET", "data /archivename.xml file", false);&lt;BR /&gt;
	Connect.setRequestHeader ("Content-Type", "text / xml");&lt;BR /&gt;
	Connect.send (null);&lt;/P&gt;

&lt;P&gt;What is the problem?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2015 10:29:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052334#M50526</guid>
      <dc:creator>pedro_v_</dc:creator>
      <dc:date>2015-09-29T10:29:58Z</dc:date>
    </item>
    <item>
      <title>Hello,</title>
      <link>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052335#M50527</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 16.3636px;"&gt;Under the "Build Settings" you will find a section named "Domain List" where you can enter the domains you wish to provide access to (or use * or all domains). Can you check that?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 16.3636px;"&gt;Which XDK version are you using?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2015 17:39:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052335#M50527</guid>
      <dc:creator>Amrita_C_Intel</dc:creator>
      <dc:date>2015-09-29T17:39:20Z</dc:date>
    </item>
    <item>
      <title>@pedrovi, On the device the</title>
      <link>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052336#M50528</link>
      <description>&lt;P&gt;@pedrovi, On the device the relative path will not work. You have to get the path of the folder where you app resides. To get the webroot use this function and then attache your relative path to it to access the file.&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;function getWebRoot() {
    "use strict" ;
    var path = window.location.href ;
    path = path.substring( 0, path.lastIndexOf('/') ) ;
    return path ;
}&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2015 18:54:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052336#M50528</guid>
      <dc:creator>Swati_S_Intel1</dc:creator>
      <dc:date>2015-09-29T18:54:05Z</dc:date>
    </item>
    <item>
      <title>I have changed the relative</title>
      <link>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052337#M50529</link>
      <description>&lt;P&gt;I have changed the relative path with your function, but the result is the same. In the emulate works fine, the same in the debug on android device (intel preview), but in the ios app preview doesn´t work. This is the code:&lt;/P&gt;

&lt;P&gt;function getWebRoot() {&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"use strict" ;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var path = window.location.href ;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;path = path.substring( 0, path.lastIndexOf('/') ) ;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return path ;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;//Read xml file &amp;nbsp; &amp;nbsp;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var Connect = new XMLHttpRequest();&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var FileName = getWebRoot() + "/file.xml";&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Connect.open("GET", FileName, false);&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I have Intel XDK 2496 version on Mac&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2015 19:21:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052337#M50529</guid>
      <dc:creator>pedro_v_</dc:creator>
      <dc:date>2015-09-29T19:21:00Z</dc:date>
    </item>
    <item>
      <title>There have been users who</title>
      <link>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052338#M50530</link>
      <description>&lt;P&gt;There have been users who have faced this issue trying to access media files on device. Here is a detailed answer to locating the application's root directory on different platforms:&amp;nbsp;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;&lt;A href="http://stackoverflow.com/questions/21321335/intel-xdk-directory-browsing/21392617#21392617" target="_blank"&gt;http://stackoverflow.com/questions/21321335/intel-xdk-directory-browsing/21392617#21392617&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Users have found this method useful. If it doesn't solve your issue, please post back. Thanks!&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2015 20:54:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052338#M50530</guid>
      <dc:creator>Anusha_M_Intel1</dc:creator>
      <dc:date>2015-09-30T20:54:25Z</dc:date>
    </item>
    <item>
      <title>There have been users who</title>
      <link>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052339#M50531</link>
      <description>&lt;BLOCKQUOTE&gt;
	&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;There have been users who have faced this issue trying to access media files on device. Here is a detailed answer to locating the application's root directory on different platforms:&amp;nbsp;&lt;A href="http://stackoverflow.com/questions/21321335/intel-xdk-directory-browsing/21392617#21392617"&gt;http://stackoverflow.com/questions/21321335/intel-xdk-directory-browsing...&lt;/A&gt;&lt;/P&gt;

	&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;Users have found this method useful. If it doesn't solve your issue, please post back. Thanks!&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;I have same problem and it doesn's solve this issue. Can you give us some advice?&lt;/P&gt;

&lt;P&gt;My config:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://pictub.club/image/V2clY" target="_blank"&gt;http://pictub.club/image/V2clY&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;My code:&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;function getWebRoot() {
    "use strict" ;
    var path = window.location.href ;
    path = path.substring( 0, path.lastIndexOf('/') ) ;
    return path ;
}
function loadText(url,callback) {
		alert(getWebRoot()+"/" +url);
		var xhr = new XMLHttpRequest();

		xhr.responseType = 'text';
		xhr.onreadystatechange = function() { 
		  if (xhr.readyState == 4) {  //Request is complete
			if(xhr.state == 200) {  //Response is ready
			  alert("Request succeeded. Data:  "+xhr.responseText);
callback(null, xhr.response);
			} else { //Error handler
			  alert('Request failed with error code: ' + xhr.state); 
callback(xhr.response, null);
			}
		  }
		}

		xhr.open("GET", getWebRoot() +"/"+url,true);
		xhr.send(null);
}&lt;/PRE&gt;

&lt;P&gt;I got error&amp;nbsp;'Request failed with error code: undefined'...&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 22:37:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052339#M50531</guid>
      <dc:creator>son_n_</dc:creator>
      <dc:date>2016-07-19T22:37:00Z</dc:date>
    </item>
    <item>
      <title>See this FAQ &gt; https:/</title>
      <link>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052340#M50532</link>
      <description>&lt;P&gt;See this FAQ &amp;gt; &lt;A href="https://software.intel.com/en-us/xdk/faqs/app-designer#ajax-jquery-one-fail" target="_blank"&gt;https://software.intel.com/en-us/xdk/faqs/app-designer#ajax-jquery-one-fail&lt;/A&gt; &amp;lt; it might have some clues. You may also need to check for a return code of 0, not just 200.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 04:22:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052340#M50532</guid>
      <dc:creator>PaulF_IntelCorp</dc:creator>
      <dc:date>2016-07-20T04:22:23Z</dc:date>
    </item>
    <item>
      <title>Hello,</title>
      <link>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052341#M50533</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I fix this issue by change the extension .json to .txt.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 05:11:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052341#M50533</guid>
      <dc:creator>son_n_</dc:creator>
      <dc:date>2016-07-20T05:11:46Z</dc:date>
    </item>
    <item>
      <title>Quote:Paul F. (Intel) wrote:</title>
      <link>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052342#M50534</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Paul F. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;See this FAQ &amp;gt; &lt;A href="https://software.intel.com/en-us/xdk/faqs/app-designer#ajax-jquery-one-fail"&gt;https://software.intel.com/en-us/xdk/faqs/app-designer#ajax-jquery-one-fail&lt;/A&gt; &amp;lt; it might have some clues. You may also need to check for a return code of 0, not just 200.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;I think it's a bug on iOS. If we request to a json file first, the request always fail with undefined code return.&lt;/P&gt;

&lt;P&gt;Note: After I change the extension of the first url request from json to txt and it work; all latter request work with json url.&lt;/P&gt;

&lt;P&gt;Sorry for my bad English&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 05:25:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Error-with-XMLHttpRequest-in-IOS-app/m-p/1052342#M50534</guid>
      <dc:creator>son_n_</dc:creator>
      <dc:date>2016-07-20T05:25:00Z</dc:date>
    </item>
  </channel>
</rss>

