大多数浏览器在浏览器中显示PDF时会发出多个HTTP请求 [英] Do most browsers make multiple HTTP Requests when displaying a PDF from within the browser

查看:550
本文介绍了大多数浏览器在浏览器中显示PDF时会发出多个HTTP请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在浏览器中显示PDF时,大多数(IE,FF,Safari,Chrome,Opera)是否为PDF文件生成多个HTTP请求?我正在研究与WebTrends Web Analytics软件集成的问题,围绕PDF的统计数据似乎不正确。支持告诉我,因为WebTrends解析Web服务器访问日志以确定流量,下载等,因此很难确定准确的PDF下载,因为:

当用户点击PDF并打开PDF时用户的浏览器通过Acrobat Reader浏览器插件,每个页面一次一个地下载 - 这样做是为了节省带宽,如果用户只查看50页PDF的前2页,只有第一页下载了2页。

Do most (IE, FF, Safari, Chrome, Opera) make multiple HTTP Requests for a PDF file when displaying the PDF in a browser? I am working on an issue integrating with WebTrends Web Analytics software, and the statistics around PDFs appear to be incorrect. Support told me that because WebTrends parses the Web Servers access logs to determine traffic, downloads, etc. it has a difficult time determining accurate PDF downloads because:
When a user clicks on a PDF and the PDF opens in the user's browser via the Acrobat Reader browser plug-in, each page is downloaded one-at-a-time -- it does this to conserve bandwidth, if a user only views the first 2 pages of a 50 page PDF, only the first 2 pages are downloaded.

这对我来说听起来很可疑(如何将HTTP请求仅用于提供二进制文件的一部分?) - 我已经一直在搜索谷歌,但没有发现任何与此有关的内容。

This sounds fishy to me (how could a HTTP Request be made to only serve out a portion of a binary file?) -- I've been searching Google, but haven't found anything that speaks to this.

我会尝试找一些IE软件,让我明天嗅到HTTP流量,看看我是否有可以观察到这种现象。

I will try to find some IE software that lets me sniff the HTTP traffic tomorrow to see if i can observe this phenomenon.

但是,任何信息/想法都会受到赞赏。

Any info/thoughts are appreciated though.

推荐答案

如果您的网站返回如下的HTTP响应标头:

If your site returns an HTTP response header like this:

Accept-Ranges: bytes

PDF阅读器将在读取几KB文档后关闭初始连接。然后它根据需要使用Range请求标头请求文档的各个部分,例如:

the PDF reader will close the intitial connection after reading just a few KB of the document. It then requests sections of the document as required with the Range request header, e.g.:

Range: bytes=242107-244329, 8060-76128

执行此操作的URL的示例是 http://www.ovationguitars.com/img/OVmanual.pdf

An example of a URL that does this is http://www.ovationguitars.com/img/OVmanual.pdf .

如果您没有返回Accept-Ranges标题,则PDF文档将在单个请求中下载(例如 http://manuals.info.apple.com/en/iphone_user_guide.pdf

If you don't return the Accept-Ranges header then the PDF document will be downloaded in a single request (e.g. http://manuals.info.apple.com/en/iphone_user_guide.pdf )

您可以看到PDF的行为IE浏览器使用 HttpWatch

You can see the behavior of the PDF reader in IE using HttpWatch.

**免责声明:这个答案是由HttpWatch的制造商Simtec Limited发布的**

** Disclaimer: This answer was posted by Simtec Limited, the makers of HttpWatch **

这篇关于大多数浏览器在浏览器中显示PDF时会发出多个HTTP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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