3
votes

In my current web project i create reports based on data entered by User which opens in new tab. format of report is also decided by user whether in pdf or html. This functionality is working fine in all browsers including IE7/8/9/10. But recently when i am opening the same in Microsoft Edge, rather then opening report HTML in new tab it starts downloading the HTML file.

Other redirection links of menu page are working fine in Microsoft Edge. Problem is only in opening those reports in new tab. Can you guys please help me out??

2
Are you specifying the content type as 'text/html' ? Browser tries to download a file instead of rendering when it faces some content type which it cannot handle. In your case browser is interpreting an invalid content type and hence trying to downloading it instead of rendering on a new tab. By specifying 'Content-type' as text/html you can tell the browser explicitly that the content is HTML and should be handled like HTML content.Diptendu
It works... Thanx a lot...Abhinav Parashar
I work on the Internet Explorer and Microsoft Edge team. I would like to know, if it's not too much of an inconvenience, what content-type header you were sending down in the response.Sampson

2 Answers

1
votes

As @Diptendu pointed out in the comment, You will need to specify a 'Content-type' of 'text/html' so that the browser knows that the content is strictly HTML and should render it accordingly.

1
votes

Browser tries to download a file instead of rendering when it faces some content type which it cannot handle. In your case browser is interpreting an invalid content type and hence trying to downloading it instead of rendering on a new tab. By specifying 'Content-type' as text/html you can tell the browser explicitly that the content is HTML and should be handled like HTML content.