CN106331149A - Webpage code adapting method applicable to client environment - Google Patents

Webpage code adapting method applicable to client environment Download PDF

Info

Publication number
CN106331149A
CN106331149A CN201610826916.1A CN201610826916A CN106331149A CN 106331149 A CN106331149 A CN 106331149A CN 201610826916 A CN201610826916 A CN 201610826916A CN 106331149 A CN106331149 A CN 106331149A
Authority
CN
China
Prior art keywords
client
browser
information
http
response data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610826916.1A
Other languages
Chinese (zh)
Inventor
练晓谦
周亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Future Information Technology Co Ltd
Original Assignee
Beijing Future Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Future Information Technology Co Ltd filed Critical Beijing Future Information Technology Co Ltd
Priority to CN201610826916.1A priority Critical patent/CN106331149A/en
Publication of CN106331149A publication Critical patent/CN106331149A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a webpage code adapting method applicable to a client environment. The method comprises the following steps: (1) a client browser sends HTTP request information to a website server when visiting a website; (2) the website server judges the environment information of a client where the client browser is located according to the HTTP header content in the HTTP request information; (3) the website server generates HTTP response data matching the environment information of the client and returns the HTTP response data to the client browser; and (4) the client browser processes the HTTP response data and displays the HTTP response data in a visual form. The amount of data transmitted is reduced, server bandwidth resources are saved, the page loading speed of the client browser is improved, and the user experience in page browsing is optimized.

Description

A kind of web page code adaptive approach for client environment
Technical field
The present invention relates to a kind of web page code adaptive approach for client environment, belong to networking technology area.
Background technology
HTTP head: refer in the request of HTML (Hypertext Markup Language) (HTTP) and the message of response, message header part Content.
User-Agent: belong to the ingredient in HTTP head, a kind of provides client to be used to accessing website Browser information, operation system information, the mark of hardware information.
When client browser is when accessing website, HTTP request information can be sent to target website server;Target network After site server receives the solicited message that browser is sent, http response information can be returned to browser;Browser receives (or execution) after http response information, can be resolved accordingly, then be presented to user in visual mode.
Same web page address, display form is different on different devices, such as: access on mobile phone and on computer Same web page address, the typesetting of webpage is different, can carry out more friendly displaying according to resolution.
Same web page address, renders mode different, such as on different browsers: chrome browser is supported Flash Player do not supported by Flash Player, safari browser, but uses Video Player.
The most traditional web page code adaptive approach is: client browser sends HTTP request to Website server, Corresponding response message is returned to client browser by Website server;Client browser according to self device type, Browser type, etc. information, in response data select be suitable for own situation data content, resolve, and with visualization Mode be presented to user.As shown in Figure 1.
In the above-mentioned methods, owing to, in the http response data that Website server returns, certainly having the part data content to be Browser resolves less than.Such as, http response data comprise the content that can only resolve on chrome browser and can only The content resolved on safari browser, then no matter client browser is chrome or safari, necessarily has portion Point content is not resolved to.
Therefore, the shortcoming using the method to bring is as follows:
1) it is useless for having part in http response data, is transmitted the most in a network, thus adds data transmission Amount, wastes bandwidth resources.
2) client browser needs to judge which is to need to resolve, and which is without resolving, thus adds visitor The parsing workload of family end browser, the loading velocity of the webpage that slowed down.
Summary of the invention
For technical problem present in prior art, it is an object of the invention to provide a kind of for client environment Web page code adaptive approach, this method includes: client browser, when accessing website, sends to target website server HTTP request information;After target website server receives the solicited message that browser is sent, judge visitor according to HTTP head content The environmental information (including: browser information, operation system information, hardware information) of family end, generates the most adaptive with client environment Http response data, return to client browser;After client browser receives http response information, phase can be carried out The parsing (or execution) answered, and it is presented to user in visual mode.
The technical scheme is that
A kind of web page code adaptive approach for client environment, the steps include:
1) client browser is when accessing website, sends HTTP request information to Website server;
2) Website server judges this client browser place client according to the HTTP head content in HTTP request information The environmental information of end;
3) the http response data that Website server generates the environmental information with this client adaptive return to this client Browser;
4) this client browser represents in visual mode after processing these http response data.
Further, the method that Website server generates the adaptive http response data of the environmental information with this client For: first set up an environment fitting relation table at Website server, store each client environment and the most suitable HTTP The corresponding relation of response data;Website server is inquired about therewith in this environment fitting relation table according to the environmental information of client Adaptive http response data, return to this client.
Further, described environmental information includes: browser information, operation system information, hardware equipment information.
Further, described browser information includes type and the version of the type of browser, version and browser kernel This;Described operation system information includes type and the version of operating system;Described hardware equipment information includes the class of hardware device Type, manufacturer and model.
Further, described HTTP request information includes asking row, some request header, null and request data.
Further, described request row includes requesting method field, url field and http protocol version field.
Further, each described request header includes a pair title, value.
Further, described request data is received by POST method.
Further, the described environmental information of this client is obtained by the User-Agent value of client.
Compared with prior art, the positive effect of the present invention is:
1) Website server generates the http response data the most adaptive with client environment, and returns to client, so Decrease volume of transmitted data, save server bandwidth resource;
2) client browser is without judging which code needs to resolve which code without resolving, and which reduces client The parsing workload of end browser, improves the page loading velocity of client browser, optimizes user when browsing pages The Consumer's Experience waited.
Accompanying drawing explanation
Fig. 1 is traditional web page code adaptive approach flow chart;
Fig. 2 is web page code adaptive approach flow chart of the present invention.
Detailed description of the invention
Below in conjunction with the accompanying drawings, preferred embodiment is elaborated.It should be emphasized that the description below is merely exemplary Rather than in order to limit the scope of the present invention and application thereof.
The flow chart of this invention such as Fig. 2:
Step 1: client browser, when accessing website, sends HTTP request information to Website server;
Step 2: after Website server receives the solicited message that browser is sent, judges client according to HTTP head content Environmental information (including: browser information, operation system information, hardware equipment information);
Step 3: Website server, for client environment, generates the http response data the most adaptive with client environment;
Step 4: Website server returns http response data to client browser;
Step 5: client browser, accepts http response data, resolves (or execution) accordingly, and with visually The mode changed is presented to user.
Step 1 be discussed in detail:
In HTTP request information, including request row, request header, null and 4 parts of request data.
(1) request row
Request row is made up of requesting method field, url field and 3 fields of http protocol version field, and they use space Separate.Such as: " GET/index.html HTTP/1.1 ".
The requesting method of http protocol has GET, POST, HEAD, PUT, DELETE, OPTIONS, TRACE, CONNECT.? Conventional is GET method and POST method.When client to read document from server, use GET method.Work as client To server with information more time can use POST method.Required parameter is encapsulated in HTTP request data by POST method In, occur with the form of name/value, mass data can be transmitted.
(2) request header
Request header is by name/value to forming, and often row a pair, title and value separate with English colon ": ".Request header is led to Knowing that server is related to the information of client request, typical request header has:
User-Agent: to accessing browser information that website provides client to be used, operation system information, hardware set Standby information
The discernible content type list of Accept: client
The host name of Host: request, it is allowed to multiple domain names exist together IP address, i.e. a fictitious host computer
(3) null
It is a null after last request header, sends carriage return character and newline, no longer have below notice server Request header.For a complete HTTP request, null is necessary, and otherwise server will be considered that these data asked It is sent to server the most completely, is waited for.
(4) request data
Request data does not uses in GET method, but uses in POST method.POST method is applicable to client Fill in the occasion of list.
Step 2 be discussed in detail:
By the User-Agent in HTTP request head is analyzed, it can be determined that go out the following information of client:
● the type of browser and version
● the type of browser kernel and version
● the type of operating system and version
● the type of hardware device, manufacturer and model
Such as:
User-Agent value is following character string:
Mozilla/5.0(Macintosh;Intel Mac OS X 10_11_6)AppleWebKit/601.7.7 (KHTML,like Gecko)Version/9.1.2Safari/601.7.7
For this User-Agent value, each character is analyzed:
By this User-Agent value, the following information of client browser can be obtained:
● browser is Safari, and version is 9.1.2
● browser kernel is WebKit, and version is 601.7.7
● operating system is Mac OS X, and version is 10.11.6
● hardware device is MAC computer
● other information
Step 3 be discussed in detail:
Utilizing the environmental information of client browser, Website server just can generate the most adaptive with client environment Http response data.
Such as:
The page that client browser accesses is that application APP downloads the page, and Website server is sentenced according to User-Agent value Disconnected client operating system type.If iOS operating system, then the http response data returning to client are APP program IOS version;If Android operation system, then return to the Android version that http response data are APP program of client This.
The page that client browser accesses is a common Website page, and Website server is according to User-Agent value Judge the hardware device type of client.If MAC computer, then the page code returning to client is adaptive computer widescreen Typesetting page;If iphone mobile phone, then return to the typesetting page that page code is the adaptive narrow screen of iphone mobile phone of client Face.
Wherein, the method for the http response data that Website server generation is the most adaptive with client environment is:
Website server, sets up one " environment fitting relation table ", stores client environment and the most suitable The corresponding relation of http response data.
Client browser accesses Website page, and Website server obtains client environment according to User-Agent value, with After go " environment fitting relation table " is inquired about, inquire the http response data that this client environment is adaptive, will be with this The most adaptive http response data of client environment abandon, and obtain final http response request, return to client.
Such as:
The page that client browser accesses is that application APP downloads the page, and Website server is sentenced according to User-Agent value Disconnected client operating system type:
If ● iOS operating system, " environment fitting relation table " inquires the HTTP adaptive with iOS operating system and rings Answer data (the iOS version of APP program), by the http response data adaptive with Android operation system (APP program Android version) abandon, finally return to the iOS version that http response data are APP program of client;
If ● Android operation system, inquire adaptive with Android operation system in " environment fitting relation table " Http response data (the Android version of APP program), by http response data (the APP journey adaptive with iOS operating system The iOS version of sequence) abandon, finally return to the Android version that http response data are APP program of client.
The page that client browser accesses is a common Website page, and Website server is according to User-Agent value Judge the hardware device type of client:
If ● MAC computer, " environment fitting relation table " inquires the http response data adaptive with MAC computer The http response data suitable with other hardware device types are abandoned, finally return to client by (computer widescreen typesetting) The typesetting page that page code is adaptive MAC computer widescreen;
If ● iphone mobile phone, " environment fitting relation table " inquires the http response adaptive with iphone mobile phone The http response data suitable with other hardware device types are abandoned, finally return to visitor by data (mobile phone narrow screen typesetting) The page code of family end is the typesetting page of the adaptive narrow screen of iphone mobile phone.
The above, the only present invention preferably detailed description of the invention, but protection scope of the present invention is not limited thereto, Any those familiar with the art in the technical scope that the invention discloses, the change that can readily occur in or replacement, All should contain within protection scope of the present invention.Therefore, protection scope of the present invention should be with scope of the claims It is as the criterion.

Claims (9)

1., for a web page code adaptive approach for client environment, the steps include:
1) client browser is when accessing website, sends HTTP request information to Website server;
2) Website server judges this client browser place client according to the HTTP head content in HTTP request information Environmental information;
3) the http response data that Website server generates the environmental information with this client adaptive return to this Client browse Device;
4) this client browser represents in visual mode after processing these http response data.
2. the method for claim 1, it is characterised in that it is adaptive that Website server generates the environmental information with this client The method of http response data be: first set up an environment fitting relation table at Website server, store each client's end ring Border and the corresponding relation of the most suitable http response data;Website server according to the environmental information of client at this environment Fitting relation table is inquired about http response data adaptive therewith, returns to this client.
3. method as claimed in claim 1 or 2, it is characterised in that described environmental information includes: browser information, operation system System information, hardware equipment information.
4. method as claimed in claim 3, it is characterised in that described browser information include the type of browser, version with And the type of browser kernel and version;Described operation system information includes type and the version of operating system;Described hardware sets Standby information includes the type of hardware device, manufacturer and model.
5. method as claimed in claim 1 or 2, it is characterised in that described HTTP request information includes request row, some requests Head, null and request data.
6. method as claimed in claim 5, it is characterised in that described request row include requesting method field, url field and Http protocol version field.
7. method as claimed in claim 5, it is characterised in that each described request header includes a pair title, value.
8. method as claimed in claim 5, it is characterised in that receive described request data by POST method.
9. method as claimed in claim 1 or 2, it is characterised in that obtain this client by the User-Agent value of client The described environmental information of end.
CN201610826916.1A 2016-09-14 2016-09-14 Webpage code adapting method applicable to client environment Pending CN106331149A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610826916.1A CN106331149A (en) 2016-09-14 2016-09-14 Webpage code adapting method applicable to client environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610826916.1A CN106331149A (en) 2016-09-14 2016-09-14 Webpage code adapting method applicable to client environment

Publications (1)

Publication Number Publication Date
CN106331149A true CN106331149A (en) 2017-01-11

Family

ID=57788025

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610826916.1A Pending CN106331149A (en) 2016-09-14 2016-09-14 Webpage code adapting method applicable to client environment

Country Status (1)

Country Link
CN (1) CN106331149A (en)

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107071017A (en) * 2017-03-31 2017-08-18 武汉斗鱼网络科技有限公司 Network request for Android system acts on behalf of instrument and Proxy Method
CN107124477A (en) * 2017-03-30 2017-09-01 努比亚技术有限公司 Processing method, terminal and the server of web site contents
CN107329997A (en) * 2017-06-08 2017-11-07 腾讯科技(深圳)有限公司 Page display method and device, client, storage medium
CN107608745A (en) * 2017-09-07 2018-01-19 郑州云海信息技术有限公司 A kind of method and apparatus for accelerating page loading velocity
CN108491513A (en) * 2018-03-26 2018-09-04 武汉南博网络科技有限公司 A kind of method and apparatus of platform operation information switching
CN109474680A (en) * 2018-11-02 2019-03-15 中国搜索信息科技股份有限公司 A kind of mobile device attribute detection method based on reverse proxy
CN109561131A (en) * 2018-10-19 2019-04-02 深圳点猫科技有限公司 A kind of method and electronic equipment of the downloading of language based on programming excel data
CN109597955A (en) * 2018-12-06 2019-04-09 中国电子科技集团公司第十五研究所 A kind of more browser data analysis service platforms based on cloud platform
CN109725929A (en) * 2018-12-11 2019-05-07 上海众源网络有限公司 A kind of embedded webpage loading method and device
CN109828815A (en) * 2019-01-18 2019-05-31 平安普惠企业管理有限公司 Screen adaptation method, device, equipment and storage medium based on mixed mode
CN110263281A (en) * 2019-06-17 2019-09-20 北京亚鸿世纪科技发展有限公司 The adaptive device and method of page resolution in a kind of exploitation of data visualization
CN111478942A (en) * 2020-03-06 2020-07-31 视联动力信息技术股份有限公司 Request processing method and device, electronic equipment and storage medium
CN112118285A (en) * 2020-07-31 2020-12-22 山东鲁能软件技术有限公司 Data transmission method and system suitable for client full-version browser
CN112559933A (en) * 2020-12-09 2021-03-26 福建天晴在线互动科技有限公司 Method and system for universal display of html news data on app client and webpage end
CN113411219A (en) * 2021-06-29 2021-09-17 山东派盟网络科技有限公司 Method, device and equipment for publishing front-end service

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102411574A (en) * 2010-09-17 2012-04-11 宏正自动科技股份有限公司 Network interface communication method and over-the-net keyboard, video and mouse (KVM) system applying network interface communication method
CN102497420A (en) * 2011-12-12 2012-06-13 中国电信股份有限公司 Content adaptation method and server
US20150106860A1 (en) * 2011-07-11 2015-04-16 Telefonaktiebolaget L M Ericsson (Publ) Method and System for Trick Play in Over-the-Top Video Delivery

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102411574A (en) * 2010-09-17 2012-04-11 宏正自动科技股份有限公司 Network interface communication method and over-the-net keyboard, video and mouse (KVM) system applying network interface communication method
US20150106860A1 (en) * 2011-07-11 2015-04-16 Telefonaktiebolaget L M Ericsson (Publ) Method and System for Trick Play in Over-the-Top Video Delivery
CN102497420A (en) * 2011-12-12 2012-06-13 中国电信股份有限公司 Content adaptation method and server

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107124477A (en) * 2017-03-30 2017-09-01 努比亚技术有限公司 Processing method, terminal and the server of web site contents
CN107071017B (en) * 2017-03-31 2020-06-16 武汉斗鱼网络科技有限公司 Network request agent tool and agent method for android system
CN107071017A (en) * 2017-03-31 2017-08-18 武汉斗鱼网络科技有限公司 Network request for Android system acts on behalf of instrument and Proxy Method
CN107329997A (en) * 2017-06-08 2017-11-07 腾讯科技(深圳)有限公司 Page display method and device, client, storage medium
CN107608745A (en) * 2017-09-07 2018-01-19 郑州云海信息技术有限公司 A kind of method and apparatus for accelerating page loading velocity
CN108491513A (en) * 2018-03-26 2018-09-04 武汉南博网络科技有限公司 A kind of method and apparatus of platform operation information switching
CN109561131A (en) * 2018-10-19 2019-04-02 深圳点猫科技有限公司 A kind of method and electronic equipment of the downloading of language based on programming excel data
CN109474680A (en) * 2018-11-02 2019-03-15 中国搜索信息科技股份有限公司 A kind of mobile device attribute detection method based on reverse proxy
CN109597955A (en) * 2018-12-06 2019-04-09 中国电子科技集团公司第十五研究所 A kind of more browser data analysis service platforms based on cloud platform
CN109725929A (en) * 2018-12-11 2019-05-07 上海众源网络有限公司 A kind of embedded webpage loading method and device
CN109828815A (en) * 2019-01-18 2019-05-31 平安普惠企业管理有限公司 Screen adaptation method, device, equipment and storage medium based on mixed mode
CN110263281A (en) * 2019-06-17 2019-09-20 北京亚鸿世纪科技发展有限公司 The adaptive device and method of page resolution in a kind of exploitation of data visualization
CN111478942A (en) * 2020-03-06 2020-07-31 视联动力信息技术股份有限公司 Request processing method and device, electronic equipment and storage medium
CN111478942B (en) * 2020-03-06 2024-06-07 视联动力信息技术股份有限公司 Request processing method, request processing device, electronic equipment and storage medium
CN112118285A (en) * 2020-07-31 2020-12-22 山东鲁能软件技术有限公司 Data transmission method and system suitable for client full-version browser
CN112118285B (en) * 2020-07-31 2022-05-20 山东鲁能软件技术有限公司 Data transmission method and system suitable for client full-version browser
CN112559933A (en) * 2020-12-09 2021-03-26 福建天晴在线互动科技有限公司 Method and system for universal display of html news data on app client and webpage end
CN112559933B (en) * 2020-12-09 2023-04-11 福建天晴在线互动科技有限公司 Method and system for general display of html news data on app client and webpage
CN113411219A (en) * 2021-06-29 2021-09-17 山东派盟网络科技有限公司 Method, device and equipment for publishing front-end service

Similar Documents

Publication Publication Date Title
CN106331149A (en) Webpage code adapting method applicable to client environment
KR101362384B1 (en) The method and system for browsing things of internet of things on ip using web platform
EP2724251B1 (en) Methods for making ajax web applications bookmarkable and crawlable and devices thereof
US20090069000A1 (en) Method of Enabling the Downloading of Content
CN103873918A (en) Picture processing method, device and terminal
CN107463453B (en) Method, device, equipment and storage medium for communication between different applications of same terminal
CN102904765B (en) The method and apparatus that data report
CN110730208A (en) Local device calling method and device, storage medium and device
WO2015154666A1 (en) Method for displaying webpage fragment on desktop and system for capturing webpage fragment to desktop for display
WO2014004926A1 (en) Methods and systems for secure in-network insertion of web content and web services
WO2018133772A1 (en) Method, device, storage medium, and electronic device for obtaining webpage resources
CN109634753B (en) Data processing method, device, terminal and storage medium for switching browser kernels
CN103618773A (en) Display method, device and system for thermodynamic diagrams
CN103888540A (en) Login information synchronization method, synchronized network servers and synchronizing network servers
CN110895481A (en) Rendering method, device and system of desktop application
KR101637016B1 (en) Method for providing user reaction web page
CN105279156A (en) Network information communication method and network information browsing device
CN107070885B (en) Information processing method, device and system
WO2015058614A1 (en) Bookmark storage method and device, and method and device for determining bookmark to be browsed
KR20120137629A (en) System for providing shorten url browsing with branding , method thereof, and web client thereof
CN107656934B (en) Preloading method, device and equipment
US10674022B2 (en) Server, server system, non-transitory computer-readable recording medium storing computer-readable instructions for server, and method performed by server
RU2640635C2 (en) Method, system and server for transmitting personalized message to user electronic device
CN104077117A (en) Information processing method and control point equipment
CN111680247A (en) Local calling method, device, equipment and storage medium of webpage character string

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20170111