Installing ArcGIS Javascript API

2040
1
08-09-2012 06:02 PM
FeichiShih
New Contributor II
When installing ArcGIS Javascript API, how do I specify the server url for the child modules? 

The main modules loaded by the handler (default.ashx) have the correct url (e.g. http://servername/library/3.1/jsapi), but the child modules still get loaded from the serverapi.arcgisonline.com, e.g. http://serverapi.arcgisonline.com/jsapi/arcgis/3.1/js/dojo/dojox/gfx/svg.js.

The installation guide mentioned the following, do I need ArcGIS Server for this?  I have ArcGIS Server 10.1 installed, with the web adapter, but I couldn't find where to configure this.  Do you mind explaining how it works and how to configure it? Thanks a lot in advance!

�?�Change the ArcGIS Services Directory "View In JavaScript" URL. Instructions are given in "Configuring the REST API" in the ArcGIS Server REST SDK. On Windows, the location is <Installation Location>\DeveloperKit\Help\REST\index.html. On UNIX and Linux, the location is http://<myserver>:8399/<instance>/sdk/rest/index.html where myserver is your server name and instance is the instance name (jsapi is the default). �?�Find the "JavaScript API" section for either .NET or Java for more information about parameter values.
�?�For .NET, the parameters to change in rest.config are <ArcGIS> and <ArcGISCSS>. Replace serverapi.arcgisonline.com with your server domain name.
�?�For Java, the parameters to change in rest-config.properties are jsapi.arcgis and jsapi.arcgis.css. Replace serverapi.arcgisonline.com with your server domain name.

Thanks,
Feichi
0 Kudos
1 Reply
FeichiShih
New Contributor II
I got it working now by updating the baseUrl in dojo.js:

baseUrl: (location.protocol === 'file:' ? 'http:': location.protocol) + '//' + "<server path>/jsapi/js/dojo/dojo",
0 Kudos