How to Fix IE8 Error “Unable to download X.php from yoursite.com”

February 9th, 2012 - Posted by Steve Marks to PHP, Web Development.

Rarely do I hear the words “Internet Explorer” and “Error” mentioned in the same sentence. Alright… maybe that’s a bit of a lie. Unfortunately however, few us can control what browsers our users are using so we have to try and cater for all instances. The one I’m going to talk about today is specific to IE8 and occured when trying to force the download of a PDF to the browser in a PHP script.

The error reads as follows:

Unable to download somefile.php from yoursite.com.

Internet Explorer was unable to open this site. The requested site is 
either unavailable or cannot be found. Please try again later.

After looking into the problem it turned out that the problem was down to the PHP headers being sent when outputting the file, inparticular the ‘Cache-Control’ header. If this header is not being set, or is not being set correctly you can start to experience problems.

The Solution

Previously I wasn’t using the aforementioned ‘Cache-Control’ header but apparently setting it to ‘no-cache’ or ‘no-store’ will have the same negative effect. For me the answer was to set it to ‘private’ or to set it with a blank value. Like so:

header("Cache-Control: private");

Or:

header("Cache-Control: ");

The site in question was also being used over SSL but I’m not sure if this also played a role. Regardless, the above worked and it kept our IE8 users happy.

This entry was posted on Thursday, February 9th, 2012 at 8:18 pm by +Steve Marks and is filed under PHP, Web Development. You can follow any responses to this entry through the RSS 2.0 feed.
Comments...

Fear not, we won't publish this

Comments (0)

No comments have been left yet. Be the first