File opens instead of downloading in internet explorer in a href link | Community
Skip to main content
Level 4
Nov 28, 2018 8:39 AM UTC
Solved

File opens instead of downloading in internet explorer in a href link

Hi guys,

I have this behavior on the internet explorer where if I click on download button the image will be opened in a new tab instead of prompting the download window.

Does anyone have an idea on how to change this behavior?

On others browser this seems to work just fine.

I'm using the Asset Class to get the asset download link;

path = asset.getPath();

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Nov 28, 2018 1:05 PM UTC

Can you try to add download attribute in anchor tag and check what is the behaviour

HTML a download Attribute

Arun Patidar

5 replies

arunpatidar
New Participant
Dec 9, 2018 11:42 AM UTC

Hi,

Please check for RewriteRule Flags - Apache HTTP Server Version 2.4  Redirect rules

T type is used to set mime type

T|type

Sets the MIME type with which the resulting response will be sent. This has the same effect as the AddType directive.

You can combine the use of Content-Disposition with other content-types, such as image/png or even text/html to indicate you want saving rather than display. It used to be the case that some browsers would ignore it in the case of text/html

Moreover you can set above only for IE browser

Redirect Website Requests Based on the Browser Used (Chrome, Firefox or IE)

Translate
Arun Patidar
Level 4
Dec 9, 2018 11:16 AM UTC

I feel like I'm lost here, I can't find anywhere an example for this.

Do you think you can help me with a little snippet?
Ty

Translate
arunpatidar
New Participant
Nov 29, 2018 2:22 PM UTC

Hi,

This is not code issue , this is IE behaviour though you can force image to download by adding content header as download.

Extra header can be added for images on server side as part of HTTP redirect rules.

Translate
Arun Patidar
Level 4
Nov 29, 2018 11:55 AM UTC

This doesn't seems to be applied in this case since the download attribute isn't supported by Internet Explorer 11.

Translate
arunpatidar
arunpatidarAccepted solution
New Participant
Nov 28, 2018 1:05 PM UTC

Can you try to add download attribute in anchor tag and check what is the behaviour

HTML a download Attribute

Translate
Arun Patidar