Sample scripts no longer work since upgrade to v3.0 of the API

3824
18
Jump to solution
07-04-2012 07:53 PM
StephenLead
Regular Contributor III
It looks like a batch process has been run over all of the sample scripts, eg the Hover sample, to upgrade them to use version 3.0 of the JS API.

<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.0/js/dojo/dijit/themes/claro/claro.css"> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.0"></script>


This means that the samples no longer work when copy/pasting directly from the Esri site into a local file.

[ATTACH=CONFIG]15775[/ATTACH]

If I revert those lines to use 2.8 the sample works fine.

Thanks,
Steve
0 Kudos
18 Replies
StephenLead
Regular Contributor III
Hi all,

I guess the main problem is that this new requirement (to use a web server) isn't documented anywhere. Eg, the Samples homepage still links to a video showing how to download a sample and run it from your local disk. None of the individual samples have been updated to list the requirement for a web server.

As of last week, we were all used to working a certain way, and now we need to change. That's not a problem, but there needs to be a clearer set of instructions on what's required. This affects both experienced developers (who are used to working the old way and new developers (who need to know how to get started).

This could be remedied with a new "how to use these samples" video tutorial (and complementary text version) on the Samples homepage, showing how to set up a local web server. This should also be linked from each sample page.

At the moment, developers would need to read this thread in order to figure out (a) what's wrong and (b) how to fix it.

Cheers,
Steve
0 Kudos
derekswingley1
Frequent Contributor
Hi all,

I guess the main problem is that this new requirement (to use a web server) isn't documented anywhere. Eg, the Samples homepage still links to a video showing how to download a sample and run it from your local disk. None of the individual samples have been updated to list the requirement for a web server.


The video shows using a local instance of IIS to run the sample. Notice that the html file is placed in the wwwroot directory (default location to serve files using IIS) and when it's loaded in the browser, the sample is accessed using http://, not file://.
0 Kudos
J_C_Geers
New Contributor
edit:
my bad
0 Kudos
StephenLead
Regular Contributor III
The video shows using a local instance of IIS to run the sample. Notice that the html file is placed in the wwwroot directory (default location to serve files using IIS) and when it's loaded in the browser, the sample is accessed using http://, not file://.


OK maybe the video wasn't a good example as I got frustrated by the slow clicking and stopped watching it before the end (or perhaps this makes it a good example after all, since most developers have short attention spans...)

I won't labour the point, but my feedback is that it's possible many users will be confused by the new requirements, and it would help if there was some mention of this, somewhere.

Cheers,
Steve
0 Kudos
KeithSandell
New Contributor III
If I'm running an app from the IIS root folder and I am still getting the following console error:

XMLHttpRequest cannot load http://server.arcgisonline.com/ArcGIS/rest/info?f=json. Origin http://<servername> is not allowed by Access-Control-Allow-Origin.

Should I be concerned? What could be causing this?

This is the World Street Map example straight copy and paste.
0 Kudos
derekswingley1
Frequent Contributor
If I'm running an app from the IIS root folder and I am still getting the following console error:

XMLHttpRequest cannot load http://server.arcgisonline.com/ArcGIS/rest/info?f=json. Origin http://<servername> is not allowed by Access-Control-Allow-Origin.

Should I be concerned? What could be causing this?


You can safely ignore that error. More info:  http://forums.arcgis.com/threads/60386-Access-Control-Allow-Origin-and-3.0?p=208466&viewfull=1#post2...
0 Kudos
StephenLead
Regular Contributor III
I promised not to labour the point, but anyway..... I just noticed that another user has run into the same issue:

Please help me. The live samples are working when i view it in the browser, but when i copy the code into notepad and run it as a local copy in the browser. The code is not working, nothing is being displayed.


I tried to link to a reference showing the need to use a web server - and I still can't find one, aside from this thread.

The Getting Started section of the help shows how to create your first application, but doesn't mention setting up a web server. Perhaps you could you add something here with simple instructions on how to set up a web server in Windows, OS and Linux?

Cheers,
Steve
0 Kudos
KristianLucido
New Contributor
Hi,
I have the same problem.
I dont have the ARCGIS API in local but in a webserver and do the correct configuration in "init.js" and "dojo.js".
What's the problem? I don't understand!

[ATTACH=CONFIG]17873[/ATTACH]

This is the image of the error in Firebug. "192.168.13.56" is my address IP in my network. The url of the file is not good!

Please help me!

Thanks in advance!
0 Kudos
derekswingley1
Frequent Contributor
It would be better if you started a new thread instead of piggy-backing on this one since it's already been answered. Can you start a new thread, and in that thread, post the code for the page that is generating that error.
0 Kudos