I am using the following Visualforce Page as an endpoint that generates a CSV file using POST data that it is handed. The following page definition works great for everything but IE8 (Internet Explorer 8):

<apex:page contentType="text/csv#{!fileName}.csv" 
        showHeader="false" sidebar="false" standardStylesheets="false">
     <apex:outputText value="{!input}" escape="false"/>

with controller

public with sharing class ExportController {

// Controller for ExportData.page,
// which expects to be handed the following POST variables:
// @inputdata(string) data to export (i.e. in CSV format)
// @filename(string) name of the file to export, e.g. 'AccountData' 

public transient String input { public get; private set; }
public transient String fileName { public get; private set; }

public ExportController() {
    Map<String,String> params = ApexPages.currentPage().getParameters();

    // We expect to be handed POST variables called 'inputdata' and 'filename'
    fileName = params.get('filename');
    if (fileName == null) fileName = 'Data';

    input = params.get('inputdata');
    if (input == null) input = 'No data provided.';

In IE8, the error I get is:

Internet Explorer cannot download ExportData from nexus.na12.visual.force.com. Interent Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.

I know that the page is not unavailable, however, because I am getting debug logs from it using Developer Console. So it must be an IE8 file type handling issue of some sort.

2 Answers 2


You have to set cache="true" and contentType="application/octet-stream instead of text/csv.

<apex:page cache="true" 
        showHeader="false" sidebar="false" standardStylesheets="false">
     <apex:outputText value="{!input}" escape="false"/>

The key pieces here are cache=true, which, in conjunction with the default expires=0 attribute, produces the following HTTP headers:

"Cache-Control: must-revalidate, post-check=0, pre-check=0"
"Cache-Control: public"

And then the contentType of application/octet-stream --- which produces the following HTTP header:

"Content-Type: application/octet-stream"

See this article for additional explanation of IE8's handling of these headers.

  • 3
    IE... just can't resist making life hell for web developers. Do other browsers handle the content type correctly? Commented Oct 26, 2012 at 22:00
  • I've always had to do the cache and expires, but for csv I'd use text/csv for the content type Commented Oct 30, 2012 at 6:22
  • I had no problems with the text/csv content-type other than with IE8, and I didn't have to use cache and expires with other browsers either.
    – zachelrath
    Commented Nov 1, 2012 at 10:24
<apex:page standardController="Account" 

    <apex:outputText value="<personne>Toto</personne>" /> 


personne.xml will give the name of file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .