HOW TO
When using ArcGIS for Server in an isolated or secure environment, it may not be possible to access the hosted Esri JavaScript API libraries. This article provides a walkthrough for installing a local copy of the JavaScript API and configuring it for use with ArcGIS for Server.
Note: This document assumes that Microsoft IIS is being used as the web server. If using a different program, some steps may not apply or may be different based on that configuration. Please consult that software’s documentation if needed.
Download and install the JavaScript API
Note: At time of publishing the current JSAPI release is 3.16 and all subsequent folder paths include this information. If using an alternate version adjust the paths accordingly.
C:\Users\<user>\Downloads\arcgis_js_v316_api\arcgis_js_api C:\Users\<user>\Downloads\arcgis_js_v316_sdk\arcgis_js_api
C:\inetpub\wwwroot\arcgis_js_api
C:\inetpub\wwwroot\arcgis_js_api\library C:\inetpub\wwwroot\arcgis_js_api\sdk
Modify JavaScript files
Note: Please note in the following two steps, do not include 'http://' with the fully qualified host name as this is already defined in the two files.
C:\inetpub\wwwroot\arcgis_js_api\library\3.16\3.16\init.js
<myhost.example.com>/arcgis_js_api/library/3.16/3.16/
C:\Inetpub\wwwroot\arcgis_js_api\library\3.16\3.16\dojo\dojo.js
<myhost.example.com>/arcgis_js_api/library/3.16/3.16/Edit ArcGIS services
http://localhost:6080/arcgis/admin/system/handlers/rest/servicesdirectory
http://myhost.example.com/arcgis_js_api/library/3.16/3.16/init.jsJavascript API SDK URL:
http://myhost.example.com/arcgis_js_api/sdk/Javascript API CSS URL:
http://myhost.example.com/arcgis_js_api/library/3.16/3.16compact/dijit/themes/tundra/tundra.cssJavascript API CSS2 URL:
http://myhost.example.com/arcgis_js_api/library/3.16/3.16/esri/css/esri.css
Note: If the server is configured to use HTTPS only, modify the examples above to use HTTPS instead of HTTP as the URL connection.
Note: To confirm that ArcGIS for Server is using the correct settings for the JavaScript API, open a web debugging program and preview a map service using the ArcGIS JavaScript viewer from the Services Directory (REST). If configured correctly, the viewer should load successfully and all URLs listed in the web debugger are from the local web server and not from 'serverapi.arcgisonline.com'
Get help from ArcGIS experts
Download the Esri Support App