: Unable to print login-required images in IE I have some images in a section of a site that require the user to be logged in in order to view. These images are served by a PHP script, which
I have some images in a section of a site that require the user to be logged in in order to view. These images are served by a PHP script, which checks the user's login state and if valid, serves the binary data with the appropriate headers. This all works fine.
The issue comes when a user tries to print one of these images. In Internet Explorer, when they go to print preview, they get the broken image box with a red cross in the corner instead of the actual file. This is also what gets printed. All other browsers can print the images without issue.
I have some images elsewhere on the site that are also served via. PHP but these don't require a login. These print fine.
The PHP-powered HTML pages on the site that require a login also print fine in IE. It's just login-required images.
When the user hits 'print preview', this does not seem to result in additional HTTP request to the server for the file. However I do see an additional HTTP request a few seconds later that comes from the same IP (may or may not be related), This request includes no host header, no REQUEST_URI and no user agent.
The 'please login' page sends an appropriate 403 header. I've also added a far-in-future expires header to the image response itself to ensure that browsers can serve/print the files from their own cache but this hasn't made any difference.
Why can't IE print the images and what else can I do to investigate or fix the problem?
More posts by @Cooney921
1 Comments
Sorted by latest first Latest Oldest Best
It seems that print preview doesn't have access to your current session, or just has a session on it's own. Or possible not even a 'browser' and just renders the page as an image towards a clientside app.
So I think your best bet is to use some other form of authentication for the images.
cookies? database? or provide a temporary full access page for printing without auth?
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.