Content-Disposition:What are the differences between quot;inlinequot; and quot;attachmentquot;?(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"有什么区别?和“附件"?
基础教程推荐
- C# 从 List<List<int>> 中删除重 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- WPF 模态进度窗口 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
