Table of Contents

Installing the ArcGIS API for JavaScript Library on Windows

The instructions below assume that you are installing the ArcGIS JavaScript API library in the following location on Internet Information Services (IIS) for Windows® Server, http://fqdn.tld/arcgis_js_api/library/4.0/ where fqdn.tld is the combination of the fully qualified domain name and top level domain of your web site. After copying files to your web server, you will need to edit some files to include the URL to the server and the target installation directory.

If you are using a non-Windows operating system, please see the instructions on deploying the library on Unix/Linux/Apache.

  1. Copy \arcgis_js_api\library and all its contents from the DVD to your web server. In this example the files are copied to: C:\Inetpub\wwwroot\arcgis_js_api\library

Install the Build

  1. Open C:\Inetpub\wwwroot\arcgis_js_api\library\4.0\4.0\init.js in a text editor and search for the text [HOSTNAME_AND_PATH_TO_JSAPI], and replace this text with fqdn.tld/arcgis_js_api/library/4.0/4.0/
  2. Open C:\Inetpub\wwwroot\arcgis_js_api\library\4.0\4.0\dojo\dojo.js in a text editor and search for the text [HOSTNAME_AND_PATH_TO_JSAPI], and replace this text with fqdn.tld/arcgis_js_api/library/4.0/4.0/

Test the Install

Now you should be able to access the ArcGIS JavaScript library from your web server using the following URL:

<script src="http://www.example.com/arcgis_js_api/library/4.0/4.0/init.js"></script>

Test your install. You can use the following test code to validate your JSAPI library install.

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
    <title>Test Map</title>
    <link rel="stylesheet" href="http://www.example.com/arcgis_js_api/library/4.0/4.0/dijit/themes/claro/claro.css" />
    <link rel="stylesheet" href="http://www.example.com/arcgis_js_api/library/4.0/4.0/esri/css/main.css" />
    <style>
      html, body, #ui-map-view {
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
      }
    </style>
    <script src="http://www.example.com/arcgis_js_api/library/4.0/4.0/init.js"></script>
    <script>
      var myMap, view;
      require([
        "esri/Basemap",
        "esri/layers/TileLayer",
        "esri/Map",
        "esri/views/MapView",
        "dojo/domReady!"
      ], function (Basemap, TileLayer, Map, MapView){
        // --------------------------------------------------------------------
        // If you do not have public Internet access then use the Basemap class
        // and point this URL to your own locally accessible cached service.
        // 
        // Otherwise you can just use one of the named hosted ArcGIS services.
        // --------------------------------------------------------------------
        var layer = new TileLayer({
          url: "http://www.example.com/arcgis/rest/services/Folder/Custom_Base_Map/MapServer"
        });
        var customBasemap = new Basemap({
          baseLayers: [layer],
          title: "Custom Basemap",
          id: "myBasemap"
        });
        myMap = new Map({
          basemap: customBasemap
        });
        view = new MapView({
          center: [-111.87, 40.57], // long, lat
          container: "ui-map-view",
          map: myMap,
          zoom: 6
        });
      });
    </script>
  </head>
  <body class="claro">
    <div id="ui-map-view"></div>
  </body>
</html>

Installing the ArcGIS JavaScript API SDK

The ArcGIS JavaScript API SDK can be copied in its entirety to your web server directory. This SDK is equivalent to the version found on the ArcGIS for Developers JavaScript site.

Copy \arcgis_js_api\sdk and all its contents from the DVD to your web server. In this example the files are copied to: C:\Inetpub\wwwroot\arcgis_js_api\sdk

The start page is index.html.

Feedback on this topic?