浏览器发送"Dalvik"作为用户代理 [英] Browser sending "Dalvik" as user agent

查看:301
本文介绍了浏览器发送"Dalvik"作为用户代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android浏览器在请求标头中发送Dalvik作为用户代理.

Android Browsers is sending Dalvik as the user agents in the request headers.

我目前正在一个具有简单登录页面的移动网站上工作,该页面会先验证用户名和密码,然后再授权用户个人资料.

I am currently working on a mobile site having a simple login page that validates username and password then authorizes users profile.

但是当我检查请求标头时,我看到了不寻常的情况,同一设备上有两个用户代理.

But when i checked the request headers i saw something unusual, there were two user agents from the same device.

以下是来自同一设备的用户代理:

Following are the user-agents from the same device:

"Mozilla/5.0 (Linux; Android 4.1.2; C5303 Build/12.0.A.1.257) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36"

"Dalvik/1.6.0 (Linux; U; Android 4.2.2; C2004 Build/15.2.A.2.5)"

即使是有些奇怪的初始化Cookie,我们也会重置或丢弃.

Even something strange the cookies that were initialed we either reset or dropped.

有什么方法可以进一步调试此信息以获取更多信息并更好地了解此问题吗?

Is there any way i can debug this further for more information and get a better view on this issue??

在旧的android手机或ios或Windows手机中看不到此问题.

This issue is not seen in old android phones or ios or windows phones.

**在具有KitKat/JellyBean OS的高端android手机中发现了这个问题

**Issue noticed in high end android mobile handsets having KitKat/JellyBean OS

推荐答案

我刚刚注意到类似的用户代理模式用于背对背请求.就我而言,第一个请求(使用Mozilla用户代理)来自嵌入式Web视图.要求的URL是下载PDF文件.我发现Android Webview无法处理PDF内容类型,因此它会通过意图启动PDF查看器.但是,在启动此查看器之前,Android会再次请求相同的URL.在第二个请求中,显示了Dalvik用户代理.

I just noticed a similar pattern of User-agents for back to back requests. In my case, the first request (with the Mozilla User agent) was from an embedded webview. The requested URL was to download a PDF file. What I've found is that the Android webview cannot handle the PDF content type, so it launches a PDF viewer through an intent. However, before this viewer is launched Android makes a second request for the same URL. In the second request, the Dalvik user agent is presented.

之前已经讨论了两个请求的奇怪之处,请参见在Webview已经获取文件之后调用setDownloadListener onDownloadStart吗? WebView-如果没有两次请求就无法下载文件?.

The two request strangeness has been discuss before, see Is setDownloadListener onDownloadStart called after the webview already Gets the file? and WebView - can't download file without requesting it twice?.

在我的第一个请求中,从Web视图中,我看到了用户代理:

In my first request, from the webview, I see the user agent:

Mozilla/5.0(Linux; U; Android 4.2.2; zh-CN; Galaxy Nexus)Build/JDQ39)AppleWebKit/534.30(KHTML,如Gecko)版本/4.0移动版Safari/534.30

Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; Galaxy Nexus Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

第二个请求(我认为是来自Android OS,而不是Webview)显示了用户代理:

The second request (which I assume is from the Android OS, and not the webview) shows the user agent:

Dalvik/1.6.0(Linux; U; Android 4.2.2; Galaxy Nexus Build/JDQ39)

Dalvik/1.6.0 (Linux; U; Android 4.2.2; Galaxy Nexus Build/JDQ39)

这篇关于浏览器发送"Dalvik"作为用户代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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