dan04
dan04

Reputation: 91189

Using the HTTP Accept Header from JavaScript

Earlier this year, someone was in the same boat, and got the response

You cannot do it using javascript capabilities, since javascript has no permission to write on client machine, instead you can send request to server to create csv file and send it back to client.

So I added a button that does

window.open("MyWebService.cgi?" + theSameQueryStringIPassedInTheAjaxCall),

which opens the HTML version in a new browser tab. I want the CSV version. Is there a way I could pass an Accept: text/csv HTTP header? (I know how to do it with XMLHttpRequest and setRequestHeader, but that doesn't help me.)

Upvotes: 1

Views: 2212

Answers (1)

Maurice Perry
Maurice Perry

Reputation: 32831

Don't think so. I think you should use an parameter instead.

Upvotes: 1

Related Questions