有谁知道如何处理这些错误?我是Javascript新手,目前我正在尝试学习esri的一些API。我真的不明白这些错误意味着什么或如何去解决它们。这里是错误:有没有人真的知道如何解决这些错误?
XMLHttpRequest cannot load file://www.arcgis.com/sharing/rest/content/items/b3c3566f3e1c4b6b8035185fba217f54?f=json. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
q {message: "Unable to load file://www.arcgis.com/sharing/rest/…b3c3566f3e1c4b6b8035185fba217f54?f=json status: 0", response: Object, status: 0, responseText: "", xhr: XMLHttpRequest…}
这是使它们的代码。
<!doctype html>
<html>
<head>
<title>Create a Web Map</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.14/esri/css/esri.css">
<style>
html, body, #mapDiv, .map.container{
padding: 0;
margin: 0;
height: 100%;
}
</style>
<script>var dojoConfig = { parseOnLoad:true };</script>
<!--<script> Access-Control-Allow-Origin: null </script> perhaps this could be part of a solution-->
<script src="http://js.arcgis.com/3.14compact/"></script>
<script>
var map;
require([
"esri/map",
"esri/arcgis/utils",
"dojo/domReady!"
], function(Map, arcgisUtils){
arcgisUtils.createMap("b3c3566f3e1c4b6b8035185fba217f54", "mapDiv").then(function (response) {
map = response.map;
});
});
</script>
</head>
<body>
<div id="mapDiv"></div>
</body>
</html>
任何帮助将是伟大的。我不得不说,我完全失去了这一点。
不要在文件协议上运行。了解CORS – epascarello
@Steve浏览器铬/铬? – guest271314
是的它是铬 – Steve