0

I am trying to print a web map using ArcGIS javascript 3.10 under IE9 but got RequestError: Unable to load /proxy?http://myserver:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task/execute status: 404. However, the same map printed without any problem for IE11, Chorme and Firefox. This seems to me is because of proxy error but only specific to IE9.

The codes as follow:

esriConfig.defaults.io.proxyUrl = "/proxy";
function createPrintDijit() {
  var layoutTemplate, templateNames, mapOnlyIndex, templates;
  var path = document.getElementById("path").value;
  var printTitle = document.getElementById("printTitle").value;
  var legendLayers = [];
  var legendLayer = new LegendLayer();
  legendLayer.layerId = "countryParks"
  legendLayers.push(legendLayer);
  legendLayer = new LegendLayer();
  legendLayer.layerId = "amphibianGridMap"
  legendLayers.push(legendLayer);
  var layouts = [{
    name: "Letter ANSI A Landscape",
    label: "Landscape (PDF)",
    format: "pdf",
    options: {
      legendLayers: legendLayers, // empty array means no legend
      scalebarUnit: "Kilometers",
      titleText: printTitle
    }
  }];
  var templates = arrayUtils.map(layouts, function (lo) {
    var t = new PrintTemplate();
    t.layout = lo.name;
    t.label = lo.label;
    t.format = lo.format;
    t.layoutOptions = lo.options;
    return t;
  });
  app.printer = new Print({
    map: app.map,
    templates: templates,
    url: "http://myserver/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task"
  }, dom.byId("printButton"));
  app.printer.startup();
}

1

IE9 does not support CORS, so the JavaScript API is smart enough to switch to a proxy. Now the proxy typically ends with "/proxy/proxy.ashx" or "/proxy/proxy.php" or "/proxy/proxy.jsp" if using the Esri supplied code which is available here

https://github.com/Esri/resource-proxy

If your application and the ArcGIS Server are served from the same domain, you will NOT require the proxy for any browser version.

  • most of this information is good, but i'm not sure what the benefit would be of setting alwaysUseProxy to true.... more info here – John Gravois Jan 30 '15 at 7:05
  • Yes thats right John. Edited the post. – Aamir Suleman Jan 30 '15 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.