<?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 Re: Problems with API 4 beta running in a Windows Store application WebView in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-with-api-4-beta-running-in-a-windows/m-p/384535#M35583</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Austin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for posting the suggestion. This will be discussed and evaluated in the near future.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Aug 2015 17:58:36 GMT</pubDate>
    <dc:creator>KristianEkenes</dc:creator>
    <dc:date>2015-08-11T17:58:36Z</dc:date>
    <item>
      <title>Problems with API 4 beta running in a Windows Store application WebView</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-with-api-4-beta-running-in-a-windows/m-p/384534#M35582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P class="p1"&gt;I was trying to get the official &lt;A href="https://developers.arcgis.com/javascript/beta/guide/getting-started-2d/"&gt;&lt;EM&gt;Create 2D Map&lt;/EM&gt; &lt;/A&gt;sample running with the &lt;A href="https://developers.arcgis.com/en/downloads/"&gt;offline distribution&lt;/A&gt; of the API inside of a WebView in a Windows Store application.&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;It turned out to be a non-trivial task and I needed to make a few changes to the official API distribution to get the sample working.&lt;/P&gt;&lt;P class="p1"&gt;Most of the problems were related to the URL scheme/protocol &lt;EM&gt;ms-appx-web:&lt;/EM&gt; used by Windows Store applications’ WebViews.&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;Let’s start with the installation.&lt;/P&gt;&lt;P class="p1"&gt;According to the official &lt;EM&gt;install.htm&lt;/EM&gt; one should replace &lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;[HOSTNAME_AND_PATH_TO_JSAPI]&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;with&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;lt;myserver&amp;gt;/arcgis_js_api/library/4.0beta1/4.0beta1/&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;That was not working for me at the first attempt so I decided to modify the entire &lt;SPAN style="font-family: 'courier new', courier;"&gt;baseUrl&lt;/SPAN&gt; property.&lt;/P&gt;&lt;P class="p1"&gt;I replaced&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;baseUrl:(location.protocol === 'file:' ? 'http:' : location.protocol) + '//' + "[HOSTNAME_AND_PATH_TO_JSAPI]dojo"&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;with&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;baseUrl:"arcgis_js_api/library/4.0beta1/4.0beta1/“&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;I’ve used the same trick also with the API version 3.14 a few months ago. &lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;After I got the &lt;SPAN style="font-family: 'courier new', courier;"&gt;baseUrl&lt;/SPAN&gt; property right the API started to load but it failed to get the basemap. The exception I was getting was “&lt;EM&gt;The system cannot locate the resource specified.&lt;/EM&gt;” The problem was that the API was trying to get the basemap from an invalid URL&lt;/P&gt;&lt;P class="p1"&gt;&lt;EM&gt;ms-appx-web://00000000-0000-4444-0000-000000000000/SampleApp/ms-appx-web://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer&lt;/EM&gt;&lt;/P&gt;&lt;P class="p1"&gt;instead of &lt;/P&gt;&lt;P class="p1"&gt;&lt;EM&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" rel="nofollow" target="_blank"&gt;http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;I managed to trace this problem back to a &lt;SPAN style="font-family: 'courier new', courier;"&gt;getabsoluteurl(a)&lt;/SPAN&gt; method in &lt;EM&gt;init.js&lt;/EM&gt; file.&lt;/P&gt;&lt;P class="p1"&gt;It is incorrectly determining the URL scheme. It recognizes &lt;EM&gt;http&lt;/EM&gt; and &lt;EM&gt;https&lt;/EM&gt; only. &lt;/P&gt;&lt;P class="p1"&gt;I fixed my problem my replacing a regular expression&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/^https?:\/\//i&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;with&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;(https?|ms-appx-web)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;This changed moved me one step further to another exception. This time it was complaining about&lt;/P&gt;&lt;P class="p1"&gt;&lt;EM&gt;ms-appx-web://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer?f=json&amp;amp;callback=dojo.io.script.jsonp_dojoIoScript1._jsonpCallback&lt;/EM&gt;&lt;/P&gt;&lt;P class="p1"&gt;See that it’s again using the &lt;EM&gt;ms-appx-web&lt;/EM&gt; scheme instead of &lt;EM&gt;http&lt;/EM&gt;. I couldn’t find the place where this URL is being built.&lt;/P&gt;&lt;P class="p1"&gt;I helped myself by prepending&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;http:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;to&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;//services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;in &lt;EM&gt;init.js.&lt;/EM&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;For some reason I had to do the same trick for &lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;//elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;Finally it all started to work and the basemap loaded and displayed correctly.&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;I know that my changes are not the best ones. I made just to move forward to get the sample running. They are not complex and I do not know what side effects they might have that I’ll run into later when I’ll start migrating our existing Windows Store application built with API 3.14.&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;It would help me a lot if there was an official support for this type of deployment in the future API 4 releases. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2015 08:02:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-with-api-4-beta-running-in-a-windows/m-p/384534#M35582</guid>
      <dc:creator>AustinMulder</dc:creator>
      <dc:date>2015-08-07T08:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with API 4 beta running in a Windows Store application WebView</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-with-api-4-beta-running-in-a-windows/m-p/384535#M35583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Austin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for posting the suggestion. This will be discussed and evaluated in the near future.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Aug 2015 17:58:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-with-api-4-beta-running-in-a-windows/m-p/384535#M35583</guid>
      <dc:creator>KristianEkenes</dc:creator>
      <dc:date>2015-08-11T17:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with API 4 beta running in a Windows Store application WebView</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-with-api-4-beta-running-in-a-windows/m-p/384536#M35584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/11069"&gt;Austin Mulder&lt;/A&gt;​ do you have a basic sample app I can test this with? I'm pretty new to Windows Store Universal Apps and trying to debug this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can email me if you like rrubalcava at odoe.net&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Aug 2015 15:45:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-with-api-4-beta-running-in-a-windows/m-p/384536#M35584</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2015-08-25T15:45:05Z</dc:date>
    </item>
  </channel>
</rss>

