The ArcGIS API for JavaScript is available to developers in several configurations. The manner in which you decide to consume the API may depend on how you intend to consume it. Some of the factors that may influence the consumption method are network access, application deployment, functionality, and optimization. The majority of developers and consumers of the JavaScript API will use the Content Delivery Network (CDN). The JavaScript API is hosted by Esri and is available for free use, please read the Terms of Use - FAQ for more info. Note: The code for the ArcGIS API for JavaScript cannot be modified. The remainder of this topic will cover the details related to the options in which you may obtain the API.
The recommended approach for accessing the API is to use the hosted version by adding the following script and link tags to your page:
<link rel="stylesheet" href="https://js.arcgis.com/3.46/esri/css/esri.css"> <script src="https://js.arcgis.com/3.46/"></script>
Benefits to working with the hosted version of the API:
The Web Optimizer is no longer available for creating 3.x-based custom-builds of the ArcGIS API for JavaScript. If your app references a custom build that was previously created, it will continue to work for the time being, however all custom-builds will be removed from our hosting environment in July 2022. Our recommendation is to start using version 4.x of the API, as it offers a lot more flexibility and simplicity when creating custom-builds. See Introduction to Tooling for more details. If you would like to continue to use 3.x, we recommend using the CDN version or download a local build.
The compact build of the ArcGIS API for JavaScript was the only choice for a smaller build before the availability of the Web Optimizer. The purpose of the compact build was to present developers and consumers of the JavaScript API with a subset of all the modules in the JavaScript API (based upon the most frequently used modules). It was designed for minimizing the number of modules an application had to download when building applications where slower connection speeds and network latency are an issue. For example, on a mobile device, where you want the smallest possible download. This build is also a great option if you want to use a JavaScript library other than Dojo.
Note: While the compact build is good choice for developers wanting a smaller initial library, it is recommended to create a custom build using the Web Optimizer once you are ready to deploy your application. It is for this reason that many developers may not have the same reliance on the compact build as they did before the Web Optimizer was available.
To use the compact build, add the following script tag to your application:
<script src="https://js.arcgis.com/3.46compact/">
Primary differences between compact build and standard build.
require()
. For example, if you want to perform geoprocessing with the compact build you will need to add the following require()
statement to your application.
require(["esri/tasks/Geoprocessor", ... ], function(Geoprocessor, ... ){ ... });
These two features reduce the size of the build significantly. Less JavaScript code to execute means less work the browser has to do.
In some cases, you may need to use a locally hosted version of the JavaScript API, for example, if you are in a restricted network environment with no internet access. You can also download and install the SDK which includes the Guide, API reference, Sample Code, and documentation. The SDK available for download is a snapshot of the help from the release date of the ArcGIS API for JavaScript version 3.46 and will not include sample updates, documentation fixes etc.
To download and install the ArcGIS API for JavaScript and SDK navigate to the ArcGIS API for JavaScript download page and log-in with your Esri global account.