'Print Templates using esri.request' sample not working in Internet Explorer?

687
5
04-11-2012 04:38 AM
ChrisBuckmaster1
Occasional Contributor
Hi

I have just viewed the above sample fine in Google Chrome but when trying to view it in Internet Explorer I get a blank map with a javascript error (attached).

Is this a known issue? I am using IE7.

Thanks
0 Kudos
5 Replies
MarkLewin
New Contributor III
This line:

<!doctype html>


at the top of the page says the page should be rendered using HTML5. IE7 does not support HTML5.

Switch to IE9, or put this declaration in its place:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">


HTH,

Mark Lewin
www.marklewin.com
0 Kudos
ChrisBuckmaster1
Occasional Contributor
Hi Mark

Just gave that a go but it is still showing no map and the js error.
0 Kudos
KellyHutchins
Esri Frequent Contributor
Looks like the sample has a trailing comma - IE has a problem with those. You'll find the extra comma in the section of code that creates the print widget. Remove the comma after url:app.printUrl and the app should run in IE.


 app.printer = new esri.dijit.Print({
          "map": app.map,
          "templates": templates,
          url: app.printUr,  <---- Trailing comma is here---->
        }, dojo.byId("print_button"));
        app.printer.startup();
      }


We'll get the official sample fixed as soon as possible.
0 Kudos
derekswingley1
Frequent Contributor
This line:

<!doctype html>


at the top of the page says the page should be rendered using HTML5. IE7 does not support HTML5.


This is not true�?? while IE7 doesn't support most of the technologies commonly referred to as "HTML5", the simple doctype works for IE7. For example, see our sample that shows new query functionality at 10.1:  http://help.arcgis.com/en/webapi/javascript/arcgis/demos/query/query_statistics.html

That sample uses the simple doctype and works w/o issue in IE7. As Kelly pointed out, the real issue is the trailing comma.
0 Kudos
JeffPace
MVP Alum
This is not true�?? while IE7 doesn't support most of the technologies commonly referred to as "HTML5", the simple doctype works for IE7. For example, see our sample that shows new query functionality at 10.1:  http://help.arcgis.com/en/webapi/javascript/arcgis/demos/query/query_statistics.html

That sample uses the simple doctype and works w/o issue in IE7. As Kelly pointed out, the real issue is the trailing comma.


Be especially carefully with trailing commas in JSON.  It will break IE every time. 

I highly recommend a json validator like

http://jsonformatter.curiousconcept.com/
0 Kudos