Friday, April 24, 2009

Internet Explorer Download Problem When Using HTTPS


If you develop a secure web application and have a downloads page, you may find that your page doesn't work correctly in Internet Explorer. You may receive some sort of error message even though the document is available.
The solution for this problem is to set the following response headers to empty string (same as remove these headers):
- Pragma & Cache-Control.

Here you can find also the way I've done this in wicket:


add(new StatelessLink("downloadAttachmentLink") {
@Override
public void onClick() {
RequestCycle.get().setRequestTarget(
new ResourceStreamRequestTarget(new WebExternalResourceStream("/downloads/" + getAttachmentName())) {
@Override
protected void configure(final RequestCycle requestCycle, final Response response,
final IResourceStream resourceStream) {
final WebResponse webResponse = (WebResponse) response;
//remove these headers to make it work!
webResponse.setHeader("Pragma", "");
webResponse.setHeader("Cache-Control", "");
webResponse.setAttachmentHeader(getAttachmentName());
}
});
}
});


Links:

2 comments:

  1. Thanks for sharing this information to us. Although most of the people are not using IE anymore, as a web developer, we must know how to fix it.

    web design services philippines

    ReplyDelete
  2. i found your site through search,yours site is excellent and a nice website.The contents are nice & will grow higher in future.
    Web Development Company

    ReplyDelete