内容处置:什么是之间&QUOT的差异;内联"和"附件"? [英] Content-Disposition:What are the differences between "inline" and "attachment"?

查看:176
本文介绍了内容处置:什么是之间&QUOT的差异;内联"和"附件"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是

之间的差异

  Response.AddHeader(内容处置,附件;文件名= somefile.ext)

  Response.AddHeader(内容处置,内联;文件名= somefile.ext)

我不知道它们的区别,因为当我使用一个或另一个我总是得到一个窗口提示,询问我要下载的文件对他们俩的。我读的规格,但它是无能的。


解决方案

  

因为当我使用一个或另一个我
  得到一个窗口提示,询问我
  下载文件对他们俩的。


此行​​为取决于浏览器和您要提供服务的文件。随着内嵌,浏览器将尝试打开浏览器中的文件。

例如,如果你有一个PDF文件和Firefox / Adob​​e Reader中,内联处置将打开Firefox内的PDF,而附件将迫使它来下载。

如果你服.ZIP文件,浏览器将无法内嵌显示,所以内联和依恋倾向,该文件将被下载。

What are the differences between

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

and

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.

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.

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.

这篇关于内容处置:什么是之间&QUOT的差异;内联"和"附件"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆