Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PDF Download fails on IE < 9 via HTTPS #6750

Closed
@ghost

Description

When you deliver a "application/pdf" file to an IE lower than 9 via HTTPS the download will fail with an error thrown by the Internet Explorer stating:

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

see http://support.microsoft.com/kb/323308 for this.

This is because of the Cache-Control header that the Response class sets up by default.
see http://php.net/manual/en/function.header.php#108766

I know that there is a fix for it on IE side, but a lot of our customer still use IE 8 and don't update. I fixed this in a crappy way, just checking if the user uses IE and the to be send Content-Type matches application/pdf in Reponse::prepare().

if(preg_match("/(msie)|(MSIE)/", $request->server->get('HTTP_USER_AGENT')) > 0
            && preg_match("/(application\/pdf)/", $headers->get('Content-Type')) > 0) {
            $this->headers->remove('Cache-Control');
            $this->headers->remove('pragma');
        }

return $this;

But I'm sure this can be fixed way better. It would be great if you guys fix this in the proper way.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions