function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AutobatAutobat 

Internet Explorer blocking file download within a visualforce page

Hey Guys,
 
I have a strange one here, I have done some tinkering but sadly I have to run out for the rest of the day so thought I would leave a question up so I might have an answer for this evening and I can finish the project.
 
I have a Visualforce page that in turn loads two other Visualforce pages (long story).  In Firefox all runs perfectly, however, after some cross platform testing can see IE is going to screw me once again!  As soon as the page starts to load IE pops up a message just under the title bar saying:
 
To help protect your security, Internet Explorer blocked this site from downloading files to your computer, Click here for options....
 
Of course none of the options are helpful, trying to download the file is useless as it is the VF page it is trying to download and I’m a bit stumped to be honest.
 
Any ideas would be welcome,

 

Best Answer chosen by Admin (Salesforce Developers) 
AutobatAutobat

Aha!  I had contentType="javascript" in the apex page, looks like i had been playing with something and had not removed it after i had finsihed.

 

Steve, i owe you a beer for that one!  Many thanks

All Answers

SteveAnderson41SteveAnderson41
When you say file download, do you mean your page is using the contentType attribute?  Have you set cache="true" ?
AutobatAutobat

Aha!  I had contentType="javascript" in the apex page, looks like i had been playing with something and had not removed it after i had finsihed.

 

Steve, i owe you a beer for that one!  Many thanks

This was selected as the best answer
jnegijnegi

@Autobat Could you please share the solution with me. I am looking to create a button on VF page which will allow the user to download and save the attachment on local system.

 

Thanks,

Jagmohan