[OpenLayers-Users] Ajax POST request and file download dialog

Christopher Schmidt crschmidt at metacarta.com
Fri Sep 25 10:12:16 EDT 2009


On Fri, Sep 25, 2009 at 03:14:41PM +0200, François Van Der Biest wrote:
> Hi list,
> 
> I'm trying to make the browser download a CSV file (created on the fly
> by GeoServer using outputFormat=csv) by issuing a call to a WFS v1.1
> protocol's read method.
> The XHR is issued as a POST request, and thus, I suspect that
> browser's cannot download the response text as a file.
> Is this true, and do you know why ? Better : do you see ways to overcome this ?

Don't use XHR. Just make a <forM> element in the DOM, and call form.submit()
with target="_blank" or target an invisible iframe.

-- Chris

> The response headers seem fine to me :
> 
> Server	Jetty(6.1.8)
> Content-Type	text/csv
> Content-Disposition	attachment; filename=partenaire.csv
> Content-Encoding	gzip
> Keep-Alive	timeout=15, max=94
> Connection	Keep-Alive
> Transfer-Encoding	chunked
> 
> Thank's for shedding light on this.
> F.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list