Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Force Download CSV in IE9(Force Download CSV in IE9)
Force Download CSV in IE9 [message #972314] Mon, 05 November 2012 09:29 Go to next message
Eclipse UserFriend
Hi,

i want to force that the user have to download a csv file and open it in excel, at the moment the csv file is shown as a plane text in the browser....

Browser browser = new Browser(shell, style);
browser.setURL("......csv");

....

Can you help me please,

thanks.
Re: Force Download CSV in IE9 [message #972381 is a reply to message #972314] Mon, 05 November 2012 10:31 Go to previous message
Eclipse UserFriend
If you want to display it and have the user download it, then you will need to open it twice in the user's browser. See the FAQ entry for providing a download link[1] which has an example of using a ServiceHandler to set the appropriate headers to force the download. You will probably want to set the content type appropriately. Setting the url into a Browser widget should work for displaying the file. A common approach for initiating the download is to use a hidden Browser widget (size 0x0), but that will often get blocked in IE. The most reliable method is described in the FAQ which is to provide a link for the user to click.

Another idea would be to wrap your CSV in an HTML page for displaying in the Browser widget, and in the HEAD of that HMTL put a meta refresh tag like this:
<meta HTTP-EQUIV="REFRESH" content="5; url=/service-handler-url?download=true">

That should give the content time to load, then "redirect" to the download version which will actually leave the original content in place. It's kind of a hack, but it may work for what you need.

Hope that helps,

Cole

[1] http://wiki.eclipse.org/RAP/FAQ#How_to_provide_a_download_link.3F
Previous Topic:Where can I download the file upload jars
Next Topic:Problem with RWT-OSGi integration bundle on JBoss 7.2
Goto Forum:
  


Current Time: Tue Jun 24 16:42:58 EDT 2025

Powered by FUDForum. Page generated in 0.04308 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top