简体   繁体   中英

ArcGIS JavaScript API Error - “Unable to Load File”

I keep getting the following errors when attempting to provide my code with a webmap id in conjunction with the ESRI tutorial for ArcGIS Online Web Map :

http://imgur.com/a/WEGM9

Below is the Javascript code which I am currently using.

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>Create a Web Map</title>

        <link rel="stylesheet" type="text/css"
            href="http://js.arcgis.com/3.9/js/esri/css/esri.css" />
        <style>
            html, body, #mapDiv,.map.container{
                padding:0;
                margin:0;
                height:100%;
            }
            #legendDiv{
                background-color: #fff;
                postion: absolute !important;
                z-index: 99;
                top:10px;
                right:20px;
            }
        </style>

        <script>var dojoConfig = { parseOnLoad:true };</script>
        <script src="http://js.arcgis.com/3.9compact/"></script>
        <script>
            var map;
            require([
                    "esri/map",
                    "esri/arcgis/utils",
                    "esri/dijit/Legend",
                    "dojo/domReady!"
                    ], function(Map, arcgisUtils, Legend){
                arcgisUtils.createMap("08fdfee37898470385ad4b3752db969f", "mapDiv").then(function
             (response) {
                    map = response.map;

                var legend = new Legend({
                    map: map,
                    layerInfos:(arcgisUtils.getLegendLayers(response))
                }, "legendDiv");

                legend.startup();
                });
            });
        </script>
    </head>
    <body>
        <div id="mapDiv"></div>
        <div id="legendDiv"></div>
    </body>
</html>

The Map id is a publicly available map of Richmond, VA's Historic Sites

The same code is working fine in my browser without any error. There may be slow internet speed on your side.The second error you will get because of slow speed of internet.Not sure about first error.

I tried the same code and it's working fine.

Based from your screenshot, you are trying to open the file from your local system.

To be able to load this page successfully, you need to deploy this in your web server (IIS, tomcat, etc).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM