UCBrowser User Agent en
UCBrowser User Agent en
UC
Contents
1 OBJECTIVE AND BACKGROUND --------------------------------------------------------------------------------------------- 2 2 READING GUIDE ---------------------------------------------------------------------------------------------------------------- 3 3 CLIENT-SERVER MODEL ------------------------------------------------------------------------------------------------------ 3 4 USER-AGENT ON DIFFERENT PLATFORMS -------------------------------------------------------------------------------- 4 4.1 Android -------------------------------------------------------------------------------------------------------------------- 4 4.2 iPhone platform ---------------------------------------------------------------------------------------------------------- 5 4.3 iPad platform ------------------------------------------------------------------------------------------------------------- 5 4.4 WP platform -------------------------------------------------------------------------------------------------------------- 5 4.5 Symbian-------------------------------------------------------------------------------------------------------------------- 5 4.6 Java ------------------------------------------------------------------------------------------------------------------------- 5 5 COMMON QUESTIONS AND ANSWERS ------------------------------------------------------------------------------------- 6 5.1 How do websites judge the on-off state of the UC Browser speed mode through UA? ----------------- 6 5.2 How do websites judge via UA whether a visitor is visiting them with UC Browser or not? ---------- 7 6 UC BROWSER USER-AGENT STANDARD SPECIFIC DEFINITION (NON-DEVELOPERS CAN SKIM THE FOLLOWING CHAPTERS) --------------------------------------------------------------------------------------------------------- 7 6.1 UC Browser User-Agent format ------------------------------------------------------------------------------------- 7 6.2 UC Browser User-Agent fields specification---------------------------------------------------------------------- 7 7 UC BROWSER X-UCBROWSER-UASTANDARD SPECIFIC DEFINITION --------------------------------------------- 9 8 X-UCBROWSER-UA DETAILS ON DIFFERENT PLATFORMS --------------------------------------------------------- 13 9 SPECIFICATION ---------------------------------------------------------------------------------------------------------------- 13 9.1 APIs introduction ------------------------------------------------------------------------------------------------------ 13 9.2 Tips about how to use APIs ----------------------------------------------------------------------------------------- 14 9.3 Unit test ------------------------------------------------------------------------------------------------------------------ 18 9.4 Demo --------------------------------------------------------------------------------------------------------------------- 18 9.5 Deal with the differences between the new UA and old UA------------------------------------------------- 21
UC
Terminology: Term UA
X-UCBrowser-UA
U2 kernel
U3 kernel
Speed Mode
Explanation User-Agent. Here it refers to the standard User-Agent. This document uses the abbreviation UA to represent User-Agent. User-Agent is one of HTTP standard heads. It is mainly used to identify the user agent, statistics, tracking user behavior, as well as custom response for a particular user agent. It is not a necessary field of HTTP request, it is needed when clients apply for request. This field contains multiple product tag information. Standard address: http://tools.ietf.org/html/rfc1945#section-10.15 Refers to the extension field of UC Browser, it is mainly used for obtaining more info about the device and its functions. Refers to the rendering engine on feature phones. The pages requested by the client will be parsed and reformatted by the UC server before they are displayed on the client. The HTML pages will be compressed to fit the screen. Refers to the rendering engine on smart phones. The webpages returned by target websites are parsed by the client itself. The rendering and parse effects are better than the U2 kernel. In Speed Mode, UC uses JUC UA to obtain basic version pages. It saves traffic and its faster. In non-speed mode, UC uses Mozilla 5.0 UA to obtain advanced pages, pages display richer.
UC
2 Reading Guide
Chapter 6 to chapter 9 are for developers, chapter 1 to chapter 5 are for non-developers.
3 Client-Server Model
3.1 Proxy mode
When the client sends a request to the UC servers, it also sends the request header to the UC servers.
The UC servers will transfer not only the request but also the IP of the UC servers to the target website. This will cause a problem where the target website receives more than one visit from the UC servers. In order to avoid the target websites security mechanism being activated and the UC servers being blocked, it is recommended to add the IP of the UC servers to your white list. If you need the IP list of the UC servers, you can ask us for it.
After the target website receives the request from the UC servers, it will send the webpage back to the UC servers. After the UC servers receive the webpage from the target website, ti will compress and reformat it and send this page to the client.
After the client receives this page from the UC servers, it will render and display this page.
UC
Under direct mode, a client sends a request to the target website directly. Then the target website sends the webpages to the client and the client will parse and render the webpages.
U2-mini in Android platform with speed mode off, UA example: (OBUA is the UA of built-in browser)
OBUA UCBrowser/8.6.0.199 Mobile
UC
iPhone platform with speed mode off, UA example: (OBUA is the UA of built-in browser)
OBUA UCBrowser/8.6.0.199 Mobile
4.4 WP platform
WP platform with speed mode on, UA example: (set Nokia 900 as an example)
UCWEB/2.0 (Windows; U; wds7.10; en-US; Nokia 900) U2/1.0.0 UCBrowser/8.6.0.199 U2/1.0.0 Mobile
WP platform with speed mode off, UA example: OBUA (OBUA is the UA of IE browser mobile phone version)
4.5 Symbian
Symbian platform, Mobile UA example:
UCWEB/2.0 (Symbian; U; S60 V1; en-US; nokia E520) U2/1.0.0 UCBrowser/8.6.0.199 U2/1.0.0 Mobile
Symbian platform, Desktop UA example: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; Desktop) AppleWebKit/534.13 (KHTML, like Gecko) UCBrowser/8.9.0.25
4.6 Java
Java platform, Mobile UA example:
UCWEB/2.0 (Java; U; MIDP-2.0; en-US; nokia6300) U2/1.0.0 UCBrowser/8.6.0.202 U2/1.0.0 Mobile
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; Desktop) AppleWebKit/534.13 (KHTML, like Gecko) UCBrowser/8.9.0.25
iPhone platform with speed mode off, UA example: (OBUA is the UA of built-in browser)
OBUA UCBrowser/8.6.0.199 Mobile
5.1.3 WP platform
WP platform with speed mode on, UA example:(set Nokia 900 as an example)
UCWEB/2.0 (Windows; U; wds7.10; zh-CN; Nokia 900) U2/1.0.0 UCBrowser/8.6.0.199 U2/1.0.0 Mobile
UC
5.2 How do websites judge via UA whether a visitor is visiting them with UC Browser or not?
UC Browser s UA will contain UC Browser fields. Through UC Browser fields in UA, websites can judge whether a visitor is visiting them with UC Browser or not. For example: U3 kernel version in Android platform with speed mode off, UA example:
Mozilla/5.0 (Linux; U; Android 2.3; zh-CN; MI-ONEPlus) AppleWebKit/534.13 (KHTML, like Gecko) UCBrowser/8.6.0.199 U3/0.8.0 Mobile Safari/534.13
6 UC Browser User-Agent Standard Specific Definition (non-developers can skim the following chapters)
The User-Agent is one of the standard headers of HTTP. It is mainly used to identify the user agents and collect and track the information about the users behaviors, and to respond to some specific user agents. It is not the required field for users request, but this field will be contained in the user agent request. This field contains the tag information of different products.
Platform
Specification This field means the company name and version No. U3kernel: Mozilla/5.0 U2kernel: UCWEB/2.0 This field refers to running of the terminal platform of UC Browser. The value of this field will increase as the number of platforms do.
UC
BlackBerry
Encryption
U; I; N;
This means the security encryption type that the application contains. U (128-bit encryption) I (40-bit encryption) N (no encryption) This field means the interface language of UC Browser. It is required to be accurate to the region, because one language may be different in different areas. For the Language field in UserAgent and X-UC Browser-UA, the language code should be in lower case and the area code should be upper case. For other conditions where the Language field is quoted, the language code and area code are both in lower case. This field means the OS information about the terminal device, including the OS version No. Considering the compatibility of U2, this field of iPhone, iPod Touch, Android on the U2 kernel is iPh, iPd, Adr correspondingly. This field of Windows Phone on U2 kernel is wds.
Language
en-US; zh-CN; There are other languages, and they are not listed here.
Os Version
U3kernel: Android 2.3; ios 4.3.1; U2kernel: iPh OS 4_3_2 Adr 2.3; S60 V1; S60 V2; S60 V3; S60 V5; MIDP 2.0; wds 7.0; There are other values, and they are not listed here.
Device
Nokia 6300; Mi-ONEPlus; iPh4; iPd1; There are other devices, and they are not listed here.
This field means the device info on different platforms: On U2 kernel: The platform value for iPhone and iPod Touch are iPh and iPd. On U2 kernel: The platform value for iPhone and iPod Touch are iPhone and iPod Touch.
UC
Product/Version
UCBrowser/8.6.0.102
This field means the version No. of the rendering engine For U2 kernel, the latest version No. is 1.0.0 For U3 kernel, the version No. will update continuously This field contains the information about product and version No.
This field means the platform type and the version No. of the client. So far, there are two UC platforms: The current version No. of U2 platform is 1.0.0 The current version No. of U3 platform is 0.8.0 When you are using the built-in browser kernel (WebKit or IE), this value is null.
UC Platform/Version
Extensions
Mobile Safari/Version; Mobile There are other extension fields, and they are not listed here.
This field means the extension info. Mobile means that UC Browser gets the pages that are fit to mobile phone screens. Safari/Version means that you are using the AppleWebKit engine.
The UA of built-in browsers. Mainly used for the condition that WebKit kernel is used on the products based on U2 kernel. The UA of devices. It will contains some relevant information of devices, such as phone OS and phone model.
OBUA
Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; en-US) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7
UC
cannot be sent by the UA but can be sent by the X-UCBrowser-UA. Format: Key1(Value1);Key2(Value2);........... Flexible data structure to support dynamic data expansion. Data content includes basic data and business data, the basic data Key is fixed, business data based on the definition of the product needs and expansion. Key represents data field definitions, Value represents the value definition. Taking into account the amount of data, Key and Value may exist in compressed and defined special string. The Key field generally by a combination of lowercase letters of names, such as Platform Key is pf, Visit Mode Key is vm, and so on. Key can not be defined repeatedly. The detailed specification of each key value are shown as below: Name Key valu e pf Value example Data type Suppo rted platfo rm Basic All data platfo rms Optio Specification nal or not Requ ired This field means the terminal platform where UC Browser runs on.
Platform
UC Platform
up
This field means the platform type and the version No. There are two types of platforms: For U2 platform, the only version No. is 1.0.0 For U3 platform, the version No. Will be updated continuously If the browser is using built-in kernel (Webkit or
UC
10
Encryption
er
U; I; N;
IE), the value of this key is null. It means the security encryption type that the application contains. U (128-bit encryption) I (40-bit encryption) N (no encryption) This field means the language Browser. It is required to be accurate to the region, because one language may be different in different areas. For the Language field in UserAgent and X-UC Browser-UA, the language code should be in lower case and the area code should be upper case. For other conditions where the Language field is quoted, the language code and area code are both in lower case. This field means the rendering engine. interface of UC
Language
la
en-US; zh-CN; There other languages, and they are not here. listed are
Requ ired
Rendering
re
Rendering of the UA
Requ ired
11
UC
Device
dv
Requ ired
Product
pr
OS-Version
ov
Pixel
pi
Basic All data platfo rms Basic All data platfo rms Busi All ness platfo data rms
Density
ss
Width*Hei ght
Requ ired
Proxy Mode
pm
0: Off Busi (direct ness mode) data 1: On (proxy mode) 0: Fit to Busi screen ness 1: Zoom data view
Browsing View
bv
Night Mode
nm
0: Off 1: On
Andro id WP iOS Symbi an Java Andro id iOS Symbi an Java Andro id WP iOS Symbi an
Optio nal
Optio nal
This field means the pixel resolution, which is, the actual physical resolution of the screen. This field means the logical resolution. For example, the logical resolution for iPhone4 is 320*480. This field means if proxy mode is activated. If the browser is using built-in kernel (Webkit or IE), then pm=0 This field means if browsing view is activated.
Optio nal
12
UC
No-Image Mode
im
Screen Rotation
sr
NetType
nt
Java Andro id WP iOS Symbi an Java Andro id WP iOS Symbi an Java Andro id WP iOS Symbi an Java
Optio nal
Optio nal
means screen
Optio nal
9 Specification
This chapter is the instructions for the User-Agent, including the introduction of the APIs files and how to use them.
13
UC
The object model of the User-Agent in the HTTP Header. It is used for encapsulating the relevant field segment and providing a easy way to read the data. XUCBrowserUserAgent The object model of X-UCBrowser-UA in HTTP Header. It is used for encapsulating the relevant data segment and providing a easy way to read the field. It is inherited from the User-Agent object and provides more features of UC Browser. UserAgentFactory It is the engineering approach of the UserAgent and XUCBrowserUserAgent. It is used for parsing the corresponding HTTP Header field, and parsing the relevant field to generate the corresponding object. For the detailed APIs document, please refer to UC Browser User-Agent Instruction
UserAgent
UserAgent ua = UserAgentFactory.createUserAgent("UCWEB/2.0(Java; U; MIDP2.0; zh-CN; nokia6300) U2/1.0.0 UCBrowser/8.6.0.199 U2/1.0.0 Mobile"); System.out.println(ua.toString());
14
UC
To get information about the rendering engine The rendering engine can detect UC Browser s capacity to parse webpages. In general, UC Browser can be divided into three types: 1. U2 engine on U2 platform. For this engine, it is recommended to adapt the page to be WAP1.0 or WAP 2.0. The features of UC Browser such as Cloud Acceleration and Night mode are supported. 2. WebKit engine on U2 platform. For this engine, JS and HTML5 are supported and you
15
UC
can adapt the page with more elements. The support of Cloud Acceleration and Night mode on this platform are not as good as that on U3 engine. 3. Highly-modified WebKit engine on U3 platform. For this engine, not only JS and HTML5 but also some features of UC Browser are supported, such as Night mode and Cloud Acceleration.
UserAgent ua = UserAgentFactory.createUserAgent("UCWEB/2.0(Java; U; MIDP2.0; zh-CN; nokia6300) U2/1.0.0 UCBrowser/8.6.0.199 U2/1.0.0 Mobile"); String renderingEngine= ua.getRenderingEngine(); //Get handheld device model, for example, iPhone ua.isU2(); // The current engine does not support pages in JS or HTML5, please adapt the pages to WAP1.0 and WAP2.0. ua.isWebKit(); // The current engine support JS and HTML5, you can adapt the pages with richer element. ua.isU3(); // The current engine support JS and HTML5, you can adapt the pages with richer element. ...............
To get language parameters UC Browser differs from the International and Chinese versions. You can know whether the product you are using is the International version or Chinese version by checking the language parameter.
UserAgent ua = UserAgentFactory.createUserAgent("UCWEB/2.0(Java; U; MIDP2.0; zh-CN; nokia6300) U2/1.0.0 UCBrowser/8.6.0.199 U2/1.0.0 Mobile"); String language = ua.getLanguange(); //Get the interface language of UC Browser ...............
To get other info It provides some features, for example, whether the mobile feature is supported or not.
UserAgent ua = UserAgentFactory.createUserAgent("UCWEB/2.0(Java; U; MIDP2.0; zh-CN; nokia6300) U2/1.0.0 UCBrowser/8.6.0.199 U2/1.0.0 Mobile"); ua.isMobile(); // Whether is it is proper to display the pages in Mobile mode ua.isSupperHtml5(); // Whether the page supports html5
16
UC
........................
17
UC
ua.browingViewIsZoom(); // Zoom View ua.screenRotationFollowSystem(); // Auto Rotation ua.screenRotationLockVertical(); // Portrait ua.screenRotationLockHorizontal()); // Landscape ........................
9.4 Demo
The open source project provides some demos for developers' reference.
18
UC
Enter:
U2/1.0.0 Mobile
Enter:
pf(Java);er(U);la(zh-CN);up(U2/1.0.0);re(U2/1.0.0);dv(Nokia6300);pr(UCBrowser/8.6.0.199);ov (S40 V3);pi(320*240);de(320*240);pm(1);bv(1);nm(0);im(1);sr(2);;
19
UC
Unit Test is the unit test of UserAgent and XUCBrowserUserAgent these two classes. The unit test frame applies SimpleTest, which is open source. The related codes are in the folder named Test.
UI Test provides the testing interface in webpage form, which has the same function as that of GUITest of Java. The display effect is shown as below:
20
UC
And you will get the same results as those with Java GUITest.
9.5 Deal with the differences between the new UA and old UA
Because there are still a lot users on traditional platforms, the APIs will be compatible with the UA on traditional platforms. Because the UA specification on traditional platforms is not standardized yet, the UserAgent is only for some simple data parsing, or sometimes the User-Agent cannot be parsed because of some problem. Third-party companies have to deal with this accordingly.
21
UC
No.
<= 7.4.0.57 wap UC U2 kernel net > and = wifi 7.4.1.61
J2ME
JUC (Linux;U;AndroidVersion;Language;Model;ScreenWid e*ScreenHeight;) JUC (Linux;U;AndroidVersion;Language;Model;ScreenWid e*ScreenHeight;) Version/PFID/BID Mozilla/5.0 (Linux;U;Android_Version;Language;Model;ScreenWi de*ScreenHeight;) Version/3.1.2 Mozilla/5.0 net wifi (Linux;U;Android_Version;Language;Model;ScreenWi de*ScreenHeight;) Version/PFID/BID AppleWebKit/528.5+ (KHTML) Version/3.1.2/Browser Name+Browser AppleWebKit/528.5+ (KHTML) Browser Name+Browser
Andro id
< 3
wap
>
Mozilla/5.0 (Linux; U; Android + SDK version No. + Language + Safari/530 IUC(U;iOS_Version;Language;ScreenWide*ScreenHeig ht;) Phone model + Mobile OS version No.) UC (KHTML, like Gecko) Mobile AppleWebKit/530+
8.0.3.99
IUC(U;iOS_Version;Language;ScreenWide*ScreenHeig ht;)/Browser Name+Browser Version/PFID/BID Palm680/RC1(iPhone; U; CPU iPhone OS 2_2_1 like Mac OS X; zh-cn) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5G77 Safari/525.20 Palm680/RC1(iPhone; U; CPU iPhone OS 2_2_1 like Mac
iPhon e
WebKit kernel
wap
net wifi
OS X; zh-cn) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5G77 Name+Browser Safari/525.20/Browser Version/PFID/BID
9.5.2
You can distinguish between the new and the traditional platforms by the version No. For details, you can refer to the part about how see the version No. in: Section 6.2 Tips about how to use APIs.
22
UC