Internet Explorer和Content-Disposition标头 [英] Internet Explorer and Content-Disposition header

查看:80
本文介绍了Internet Explorer和Content-Disposition标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


大家好,



我面临一个'内容处置'标题的奇怪问题。在我的应用程序中,我将发布一些PDF文档,供最终用户查看/下载。我们的目标是当用户点击链接时,我们在浏览器窗口的右侧窗格中打开文档,并在"另存为"对话框中提供正确的文件名,如果用户右键单击并选择"将目标另存为"菜单中的选项。



我们可以通过使用'content-disposition'标题来实现这一目标。我们使用标题如下:


" Content-Disposition:inline; filename = test_file.pdf;"。



但现在我们面临一个奇怪的问题。我们上面填充的文件名是动态生成的,如果此名称包含单词"attachment",则IE而不是打开文档内联弹出"文件下载"和"文件下载"。对话框。


在这种情况下,标题如下所示:


" Content-Disposition:排队;文件名= test_attachment.pdf;" ;.



如果我删除这个单词"attachment""从上面标题的'filename'部分开始按预期工作。



根据我的理解,"文件下载"当且仅当我将处置方法指定为'附件'时,对话框应该已经过了。如果我使用了content-disposition标题,如下所示:


" Content-Disposition:attachment; filename = test_file.pdf;"。



我正在使用IE6.0和SP2。 IE的Acrobat Reader 6.0和7.0插件都可以看到上述行为。



有什么建议吗?



谢谢,


Avadhut。


< p align = left>

解决方案

大家好,



请告诉我如果我在错误的地方发布了这个问题。到目前为止,没有人给出任何建议,我感到很惊讶。如果我需要在其他论坛中移动此帖子,请告诉我吗?我真的需要一些关于这个问题的建议。



谢谢,


Avadhut。


 

Hi All,

 

I am facing a strange problem with 'content-disposition' header. In my application i will publish some PDF documents which will be available for the end users for viewing/downloading purpose. Our aim is that when a user clicks on the link we open the document in the right pane of the browser window and also provide a proper filename in the 'save as' dialog box if user does a right click and selects 'save target as' option from the menu.

 

We could achieve this by using the 'content-disposition' header. We used the header as follows:

"Content-Disposition: inline; filename=test_file.pdf;".

 

But now we are facing a strange issue. The filename we populate above is generated dynamically and if this name contains the word "attachment" IE instead of opening the document inline pops up the "File Download" dialog box.

In this situation the header looks as shown below:

"Content-Disposition: inline; filename=test_attachment.pdf;".

 

If i remove this word "attachment" from the 'filename' part of the header above things work as expected.

 

As per my understanding the "File Download" dialog box should have been poped out if and only if i had specified the disposition method as 'attachment' .i.e. if i had used the content-disposition header as follows:

"Content-Disposition: attachment; filename=test_file.pdf;".

 

I am using IE6.0 with SP2. The above behavior can be seen with both Acrobat Reader 6.0 and 7.0 plugins for IE.

 

Any suggestions?

 

Thanks,

Avadhut.

解决方案

Hi All,

 

Please let me know if i have posted this issue at wrong place. I am surprised that nobody has given any suggestions till now. Do let me know if i need to move this thread in some other forum? I m really in need of some suggestions on this issue.

 

Thanks,

Avadhut.


这篇关于Internet Explorer和Content-Disposition标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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