arcgis api for JavaScript 中出现跨域请求是常见问题, 通常出现类似如下错误消息类似: XMLHttpRequest cannot load http://10.32.2.70:8399/ArcGIS/rest/info?f=json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:58374' is there
跨域的定义:JavaScript出于安全性考虑,同源策略机制对跨域访问做了限制.域仅仅是通过“URL的首部”字符串进行识别,“URL的首部”指window.location.protocol +window.location.host,也可以理解为“Domains, protocols and ports must match”.实际上,同源策略就是浏览器的一种保护机制,只要请求双方的URL协议.域名(主机).端口有任何一个不同,都被当作是跨域. 同源策略机制从 Netscape Navigat