Content-Disposition:“inline"和“inline"有什么区别?和“附件"?

Content-Disposition:What are the differences between quot;inlinequot; and quot;attachmentquot;?(Content-Disposition:“inline和“inline有什么区别?和“附件?)

本文介绍了Content-Disposition:“inline"和“inline"有什么区别?和“附件"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

两者有什么区别

Response.AddHeader("Content-Disposition", "attachment;filename=somefile.ext")

Response.AddHeader("Content-Disposition", "inline;filename=somefile.ext")

我不知道它们的区别,因为当我使用一个或另一个时,我总是会收到一个窗口提示,要求我下载它们的文件.我读了规格,但它一无所知.

I don't know the differences , because when I use one or another I always get a window prompt asking me to download the file for both of them. I read the specs, but it is clueless.

推荐答案

因为当我使用一个或另一个时,我得到一个窗口提示,要求我下载他们两个的文件.

Because when I use one or another I get a window prompt asking me to download the file for both of them.

此行为取决于浏览器和您尝试提供的文件.使用内联,浏览器会尝试在浏览器中打开文件.

This behavior depends on the browser and the file you are trying to serve. With inline, the browser will try to open the file within the browser.

例如,如果您有一个 PDF 文件和 Firefox/Adobe Reader,内联处置将在 Firefox 中打开 PDF,而附件将强制下载.

For example, if you have a PDF file and Firefox/Adobe Reader, an inline disposition will open the PDF within Firefox, whereas attachment will force it to download.

如果您提供 .ZIP 文件,浏览器将无法以内联方式显示它,因此对于内联和附件配置,将下载该文件.

If you're serving a .ZIP file, browsers won't be able to display it inline, so for inline and attachment dispositions, the file will be downloaded.

这篇关于Content-Disposition:“inline"和“inline"有什么区别?和“附件"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Content-Disposition:“inline"和“inline"有什么区别?和“附件"?

基础教程推荐