Select to view content in your preferred language

Tutorial example doesn't run as expected, any tip?

1034
4
05-21-2013 08:05 PM
IT_AppLayers
New Contributor
Hi all,
I follow the ArcGIS API for JavaScript tutorial

http://help.arcgis.com/en/webapi/javascript/arcgis/jstutorials/intro_agstemplate.html

and can run the sample in the sandbox
http://help.arcgis.com/en/webapi/javascript/arcgis/sandbox/sandbox.html?sample=map_webmap

I was wondering why after I download the .html file provided by this example and CANNOT have it run in any browser (Map not showing)?

Thanks
0 Kudos
4 Replies
KarlSchrantz
Emerging Contributor
I am having the EXACT same problem.  I am trying to load a map of mine that I have published to Arcgis Online with the API

This tutorial seems to work when you view the "live sample" https://developers.arcgis.com/en/javascript/jssamples/ags_createwebmapid.html

But if I copy that code into an .html document locally and open it in my browser the boarders and frames load but no map or info.

If you copy the code from the Web ID tutorial into the sandbox it fails!

If you download it as a .zip file and again load it locally it Fails!

Please respond someone, these tutorials are proving to be less than helpful.
0 Kudos
ReneRubalcava
Esri Frequent Contributor
Are you running the application from a local server environment like IIS or Apache?
I could have sworn this was mentioned in the docs somewhere, but now I can't find it.

You could even use python to run a webserver to view your files, python -m -SimpleHTTPServer
Key is that the browser URL cannot be file:// or it API won't work.
0 Kudos
JohnGravois
Deactivated User
the relevant article in the help can be found here .
0 Kudos
KarlSchrantz
Emerging Contributor
Derp. Got it to work. Some of my defaults in IIS were wrong.

Thanks everyone! Hopefully this helps Arcgisforchao as well. Didn't mean to hi-jack the post, I was just having a similar problem.
0 Kudos