Of course everything works great on our dev servers but when we deploy to the clients servers the resulting print job does not automatically open in a new tab. The return Json from our Dev server looks identical to the return json from the client
-- ours
{
"paramName": "Output_File",
"dataType": "GPDataFile",
"value": {
}
}
-- vs theirs
{
"paramName": "Output_File",
"dataType": "GPDataFile",
"value": {
}
}
I though perhaps security on the browser was not allowing popups so I added
var win = window.open("http://machineName/arcgis/rest/directories/arcgisjobs/abcdefg/printvectormap_gpserver/j745b8bd480aa4... ", '_blank'); win.focus();
and that was able to open the tab and link w/o issue.
My Code:
var prntTemplate = new esriPrintTemplate(); prntTemplate.layout = $('#printLayout').val(); prntTemplate.format = $('#printFormat').val(); prntTemplate.layoutOptions = { "legendLayers": [] }; me.esriPrintTool = new esriPrint({ async: true, map: mainmap, "templates": prntTemplate, url: me.getPrintUrl("AdvancedPrint") }, dojoDom.byId("hiddenPrintBtnDiv")); me.esriPrintTool.on("error", function (evt) { me.LogError("OnPrintTool Advanced Error", evt); }); me.esriPrintTool.on("print-complete", function (evt) { toastr["info"]("Print Complete", "Advanced Print"); $('#btnAdvancedPrint').removeClass("active").val("Print"); me.onPrintComplete(); }); me.esriPrintTool.startup(); me.esriPrintTool.hide(); me.esriPrintTool.printMap(prntTemplate);
Solved! Go to Solution.
Ok it's not pretty, and it opens twice on any other machine, but this is working at the clients site.
me.esriPrintTool.on("print-complete", function (results) { if ((results) && (results.result) && (results.result.url)) { var resultsWin = window.open(results.result.url, '_blank'); resultsWin.focus(); } toastr["info"]("Print Complete", "Quick Print"); $('#btnQuickPrint').removeClass("active").val("Print"); me.onPrintComplete(); });
Ok it's not pretty, and it opens twice on any other machine, but this is working at the clients site.
me.esriPrintTool.on("print-complete", function (results) { if ((results) && (results.result) && (results.result.url)) { var resultsWin = window.open(results.result.url, '_blank'); resultsWin.focus(); } toastr["info"]("Print Complete", "Quick Print"); $('#btnQuickPrint').removeClass("active").val("Print"); me.onPrintComplete(); });
My only guess as to a cause is that, for whatever reason, the command the Ersi SDK is using to pop open that window does not work in their highly secure environment and that window.open does. Anyone have any other theories?