For download, use contenttype: Application/octet-stream and content-Disposition: attachment; filename = file. ext
You can control the file to be completely saved as a download, so you do not need to open a new window.
However, if an image is opened online, for example, in order not to affect the browsing of the current window, a new window should be opened to display the image:
<A href = "openfile? File = file. Ext "target =" _ blank "> open </a>
This is no problem. The problem is that if the opened file is unrecognizable by the browser, it is changed to download or selectProgramOpen. If the pop-up window cannot be closed automatically,
It will greatly affect the user's feelings. Therefore, to control the _ blank function, the server must
Content-Disposition: attachment; filename = file. Ext: Content-Disposition: inline; filename = file. Ext.
That is, if the content-disposition is inline when the file is opened, the _ blank window specified by target is automatically closed if the browser cannot interpret the opened file.