AnsweredAssumed Answered

Version 3.0 sample issues

Question asked by krdyke on Jun 28, 2012
Latest reply on Jun 28, 2012 by krdyke
Hi all,

I've been getting encountering issues working with samples for version 3.0. First of all, I've just started working with the API recently, so am not sure what needs to be changed with the move to Dojo 1.7 in v3.0. Using this sample as an example, after copying the code and saving it locally, I can view it in IE9, but neither Chrome or Firefox allow it. Chrome gives an error "Request header field X-Requested-With is not allowed by Access-Control-Allow-Headers", while Firefox spits out an error message of "Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://servicesbeta.esri.com/jsapi/arcgis/?v=3.0 :: <TOP_LEVEL> :: line 15" data: no]"

However, when designating the URL of the API in the head of my HTML, if instead of this:

http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.0

I use this:

http://servicesbeta.esri.com/jsapi/arcgis/?v=3.0

It then loads okay in all browsers, but still gives the errors, and intermittently does not work. The result being, I'm quite confused. 

I'm currently without an instance of Server, so hosting the API locally isn't an option at this point. Any advice as to what's happening, where I've gone wrong, etc. would be greatly appreciated. Here's the HTML I've been referencing. Hopefully I'm just making a bonehead mistake!

[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
  <!--<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.0" type="text/javascript"></script>-->
  <script src="http://servicesbeta.esri.com/jsapi/arcgis/?v=3.0" type="text/javascript"></script>
  <link href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.0/js/dojo/dijit/themes/claro/claro.css" rel="stylesheet" type="text/css" >
  <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.0/js/dojo/dijit/themes/tundra/tundra.css">
  <script type="text/javascript">
     dojo.require("esri.map");
  </script>
  <script type="text/javascript">
    dojo.require("esri.map");
    function init() {
      map = new esri.Map("mapDiv");
    var basemapURL= "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
      var basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapURL);
      map.addLayer(basemap);
    }
    dojo.addOnLoad(init);
     </script>
<title>Map</title>
</head>
<body class="claro">
  <div id="mapDiv" style="width:900px; height:600px; border:1px solid #000;"></div>
</body>
</html>[/HTML]

Outcomes