Android浏览器/网页流量的错误?内容处置:附件;文件名= QUOT; xyz.txt将该" [英] Android browser/webview bug? Content-Disposition: attachment; filename="xyz.txt"

查看:157
本文介绍了Android浏览器/网页流量的错误?内容处置:附件;文件名= QUOT; xyz.txt将该"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此​​,一个Android浏览器或网页视图工作正常,像这样的URL - abc.com/xyz.txt

不过,如果你的URL看起来像这样 - abc.com/xyz.php,什么是发送到浏览器的标题是 - 内容处置:附件;文件名=xyz.txt将该,那么Android的浏览器和Web视图似乎变得非常混乱。

它看起来像它保存在手机上正确的文件名,但内容充满了,这是previously正在浏览的网页。这完美的作品以及基于PC浏览器,并在iPhone和黑莓,这只是在Android 2.1和2.2(没有测试等)的问题。

任何人都有一个解决方案吗?将非常感激。我的真正的不想开始储存静态文件和要生成动态我的下载内容。在手机上的日志也没有发现线索。


下面是什么由服务器发送到浏览器

  =====================开始内容=============== =====================
HTTP / 1.1 200 OK
日期:星期四,2010 GMT 21点22分11秒10月21日
服务器:Apache
内容处置:附件;文件名=Wafty.txt
内容长度:30
内容类型:text / plain的;字符集= ISO-8859-1你好这是一个文件的一个测试
=========有在上述行的末尾没有回车====


解决方案

使用

 内容处置:附件;文件名=xyz.txt将该

不要用

 内容处置:附件;文件名=xyz.txt将该

So an android browser or a webview works fine with urls like this - abc.com/xyz.txt

However, if your URL looks like this - abc.com/xyz.php and what's sent to the browser in the headers is - Content-Disposition: attachment; filename="xyz.txt", then the Android browsers and web view seems to get terribly confused.

It looks like it saves the correct file name on the phone, but the contents is filled with the webpage that was previously being viewed. This works perfectly well on PC based browsers and on an iPhone and Blackberry, it's only a problem on the Android 2.1 and 2.2 (haven't tested others).

Anyone have a solution? Will be very grateful. I really don't want to start storing static files and want to generate my download content on the fly. The log on the phone has revealed no clues.


Here's what's sent by the server to the browser

===================== start content ====================================
HTTP/1.1 200 OK
Date: Thu, 21 Oct 2010 21:22:11 GMT
Server: Apache
Content-Disposition: attachment; filename="Wafty.txt"
Content-length: 30
Content-Type: text/plain; charset=ISO-8859-1

Hello this is a test of a file
========= There was no carriage return at the end of the above line ====

解决方案

use

Content-Disposition: attachment;filename="xyz.txt"

do not use

Content-Disposition: attachment;  filename="xyz.txt"

这篇关于Android浏览器/网页流量的错误?内容处置:附件;文件名= QUOT; xyz.txt将该"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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