How to disable the security hint in IE 7 and 8 while downloading a file

Hi,

in my Web-App it is also possible to downloading some files. To do that I have add a link button to my view, registered a ClickListener on that link button and implementing the listener method like it was descriped in this post: https://vaadin.com/forum/-/message_boards/view_message/308689#_19_message_300843

This works fine with Firefox and IE 9.

But if I click the file download link button in a IE 7 or IE 8 I get this small explorer message at the top of the site:

“To help protect your security, Internet Explorer blocked this site from downloading files to your computer. Click here for more options…”.

The user must then do a click at this message and accept that he wants download the file before the “normal” file download dialog was displayed (“Open” or “Save” …).

The previous version of the Web-App was developed with the ICEFaces framework (JSF). I know with ICEFaces the security message was not displayed in IE7/IE8 while downloading a file.

Anybody knows how I can prevent the security message in IE7/IE8?

Thanks a lot,
Steffen

I don’t know for sure, but I guess it’s because of the way the request for the download is made effectively from a JavaScript and not from user action as IE sees it. How about instead of Link button, you use Link component with a FileResource?

Yes, JavaScript initiated downloads are the reason for the warning.
You could also check out the
ActiveLink add-on
which is a link that allows you to get a click event if you need one. You can also use other resource types than FileResource, but you need to create the resource instance (but not necessarily the data behind it) before displaying the link.

It’s every time unbelievable: Hardly makes it right … and it works! :-))

Thanks to Johannes.

Hi,

I did it with ActiveLink and DownloadResource but it didn’t work, security hints still display, can you please post your code

Thanks

Hi,

but you must know, I don’t use the ActiveLink add-on. I use a simple Link component.

It’s long time ago and the code part was changed some times, but I hope this is right:


public class DownloadFileView extendsCustomComponent {
  
  ...
  ...
  ....
  /** resource of the download file */
  private Resource fileRes = null;
  
  /** Construct a new IE78DownloadFileView object.
   * @param fileRes the resource of the download file
   * 
   */
  public IE78DownloadFileView(Resource fileRes) {
    super();
    
    this.fileRes = fileRes;
    
    setCompositionRoot(build());
  }

  ...
  ...
  ...

  /** Builds this view.
   * @return the layout which contains this view
   */
  private Component build() {
    VerticalLayout viewLayout = new VerticalLayout();
    viewLayout.setSpacing(true);
    viewLayout.setMargin(true);
    
    ...
    ...
    ...
    
    // add download link
    Link lnkFile = new Link(fileRes.getFilename(), fileRes);
    viewLayout.addComponent(lnkFile);
    viewLayout.setComponentAlignment(lnkFile, Alignment.MIDDLE_CENTER);

    ...
    ...
    ...    
    
    return viewLayout;
  }

  ....
  ....
  ....
}

As you can see I don’t use a ActiveLink

Regards

Thanks Steffen