2

So I'm trying to export html data to excel using internet explorer (see this fiddle). It doesn't seem to work, because to my knowledge IE is blocking the download due to security reasons. Is there a better way to do this?

Ray
  • 289
  • 1
  • 2
  • 13
  • This will not work unless users are willing to set their security settings to stupidly-low levels. If you can instantiate Excel from the browser, you can also delete all their files, etc. If you want to do this then JJb has the right approach. – Tim Williams Aug 09 '12 at 18:47
  • But would it be a good method to have it call an Ajax request if IE, and do something else that doesn't require PHP with other browsers? – Ray Aug 09 '12 at 18:51
  • http://stackoverflow.com/questions/5524143/how-can-i-export-tables-to-excel-from-a-webpage – Tim Williams Aug 09 '12 at 18:55
  • I saw that question, but that doesn't answer mine. Is it a good idea to do Ajax right from the plugin? – Ray Aug 09 '12 at 19:39

1 Answers1

0

It's better to serve the data from the server with an excel mime type (application/excel) . This will make the solution browser agnostic.

JAR.JAR.beans
  • 9,668
  • 4
  • 45
  • 57
  • Well another thing is that I want to turn this in to a jQuery plugin some day, so I would like it to be all JS. Could I do this through Ajax? – Ray Aug 09 '12 at 18:10
  • If you use all js it won't be AJAX (unless you have server-side js of course). – Tim Williams Aug 09 '12 at 20:49
  • I'm too a bit confused as to why Ajax is related here. but sine ActiveX is an IE only approach, I can't see how this can be a cross browser plugin on the client side. – JAR.JAR.beans Aug 11 '12 at 19:22