I tried it with and without spaces before posting. Would not run on my server, but runs fine on my pc.I agree no change is map service display; it�??s about 50/50 for me.
<!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=utf-8"> <title>ArcGIS REST Map Services Keep Alive</title> <link rel="stylesheet" href="https://community.esri.com/ArcGIS/rest/ESRI.ArcGIS.Rest.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/1.6/js/dojo/dijit/themes/tundra/tundra.css"> <style type="text/css">html, body { height: 100%; width: 100%; margin: 0; padding: 0; }</style> </head> <body class="tundra"> <script type="text/javascript">var djConfig = {parseOnLoad: true};</script> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.6"></script> <script type="text/javascript" src="/ArcGIS/rest/services?f=json&callback=var ws_results ="></script> <script type="text/javascript"> dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("esri.map"); var map; var hostName = document.location.host; function Init() { map = new esri.Map("mapDiv"); //cycles through REST services and adds MapServer services to map for(var i=0; i<ws_results.services.length; i++){ if (ws_results.services.type == 'MapServer') { layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://" + hostName + "/ArcGIS/rest/services/" + ws_results.services.name + "/MapServer"); map.addLayer(layer); } } //resize the map when the browser resizes var resizeTimer; dojo.connect(map, 'onLoad', function(theMap) { dojo.connect(dijit.byId('mapDiv'), 'resize', function() { //resize the map if the div is resized clearTimeout(resizeTimer); resizeTimer = setTimeout( function() { map.resize(); map.reposition(); }, 500); }); }); } dojo.addOnLoad(Init); </script> <div id="mapContainer" dojotype="dijit.layout.BorderContainer" design="headline" gutters="false" style="width: 100%; height: 100%; margin: 0;"> <div id="mapDiv" dojotype="dijit.layout.ContentPane" region="center" style="overflow:hidden;"> </div> </div> </body> </html>
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.