TWI670611B - Web file sending method, webpage rendering method and device, webpage rendering system - Google Patents

Web file sending method, webpage rendering method and device, webpage rendering system Download PDF

Info

Publication number
TWI670611B
TWI670611B TW106112411A TW106112411A TWI670611B TW I670611 B TWI670611 B TW I670611B TW 106112411 A TW106112411 A TW 106112411A TW 106112411 A TW106112411 A TW 106112411A TW I670611 B TWI670611 B TW I670611B
Authority
TW
Taiwan
Prior art keywords
information
terminal
webpage
server
device information
Prior art date
Application number
TW106112411A
Other languages
Chinese (zh)
Other versions
TW201800962A (en
Inventor
王卓
Original Assignee
香港商阿里巴巴集團服務有限公司
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 香港商阿里巴巴集團服務有限公司 filed Critical 香港商阿里巴巴集團服務有限公司
Publication of TW201800962A publication Critical patent/TW201800962A/en
Application granted granted Critical
Publication of TWI670611B publication Critical patent/TWI670611B/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • 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/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/972Access to data in other repository systems, e.g. legacy data or dynamic Web page generation
    • 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/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/986Document structures and storage, e.g. HTML extensions

Abstract

本發明實施例揭露了一種網頁文件發送方法、網頁渲染方法及裝置、網頁渲染系統。所述網頁文件發送方法包括:伺服器接收終端發送的攜帶與所述終端對應的使用者代理資訊的網頁請求;所述伺服器根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊;所述伺服器獲取與所述設備資訊對應的網頁文件並向所述終端發送。在網頁渲染之前,確定終端的設備資訊並確定與設備資訊對應的網頁文件均是由伺服器來執行的,從而避免因終端執行上述步驟而過多消耗終端的處理資源的問題,進而提升終端渲染網頁的性能。 The embodiment of the invention discloses a webpage file sending method, a webpage rendering method and device, and a webpage rendering system. The webpage file sending method includes: the server receiving a webpage request sent by the terminal and carrying the user agent information corresponding to the terminal; the server determining, according to the user agent information, determining the information corresponding to the webpage proxy information The device information of the terminal; the server acquires a webpage file corresponding to the device information and sends the webpage file to the terminal. Before the rendering of the webpage, determining the device information of the terminal and determining that the webpage file corresponding to the device information is executed by the server, thereby avoiding the problem of excessively consuming the processing resources of the terminal by the terminal performing the above steps, thereby improving the rendering of the webpage by the terminal. Performance.

Description

網頁文件發送方法、網頁渲染方法及裝置、網頁渲染系統 Web file sending method, webpage rendering method and device, webpage rendering system

本發明關於網際網路技術領域,特別關於一種網頁文件發送方法、網頁渲染方法及裝置、網頁渲染系統。 The invention relates to the field of internet technology, and particularly relates to a webpage file sending method, a webpage rendering method and device, and a webpage rendering system.

現如今,藉由瀏覽器或應用APP的使用者端存取各種網頁已成為人們獲取資訊的管線之一。目前,人們所使用的各種終端往往具備不同的設備資訊(如:終端螢幕的大小),而針對終端所具備的設備資訊的不同,可在終端上展示不同的網頁樣式。例如,新浪網(http://www.sina.com.cn/)在手機和電腦上是以不同的網頁樣式進行展示的。 Nowadays, accessing various web pages through the browser of a browser or application APP has become one of the pipelines for people to obtain information. At present, various terminals used by people often have different device information (such as the size of the terminal screen), and different web page styles can be displayed on the terminal for different device information of the terminal. For example, Sina.com (http://www.sina.com.cn/) is displayed on mobile phones and computers in different webpage styles.

一般地,終端可藉由從伺服器獲取不同的網頁文件,來渲染不同的網頁樣式,上述網頁文件可包括:CSS(Cascading Style Sheets,層疊樣式表)文件、圖片等。現有技術中,在藉由瀏覽器或使用者端請求網頁的過程中,首先,由終端向伺服器發送網頁請求,隨後,伺服器回應於所述網頁請求,向終端返回在網頁載入過程中可能被使用的網頁文件。終端在接收到伺服器返回的網頁文件 之後,需要檢測到自身的設備資訊,並利用媒體查詢(media query)方法,確定與所述設備資訊相適配的網頁樣式以及渲染該網頁樣式所需載入的網頁文件。最終,終端可以從上述伺服器返回的網頁文件中,選取當前所需載入的網頁文件(如:CCS文件、圖片等)並利用這些網頁文件進行網頁的渲染。 Generally, the terminal may render different webpage styles by acquiring different webpage files from the server, and the webpage files may include: CSS (Cascading Style Sheets) files, pictures, and the like. In the prior art, in the process of requesting a webpage by a browser or a client, first, the terminal sends a webpage request to the server, and then the server returns to the terminal in the process of loading the webpage in response to the webpage request. A web page file that may be used. The terminal receives the webpage file returned by the server. After that, it is necessary to detect the device information of the device, and use a media query method to determine the style of the webpage adapted to the device information and the webpage file to be loaded to render the webpage style. Finally, the terminal may select a webpage file (such as a CCS file, a picture, etc.) currently loaded from the webpage file returned by the server, and use the webpage file to render the webpage.

上述現有技術至少存在如下問題: The above prior art has at least the following problems:

在終端渲染網頁之前,需要利用媒體查詢方法確定與該終端的設備資訊相適配的網頁樣式以及渲染該網頁樣式所需載入的網頁文件,並從伺服器返回的網頁文件中選取當前所需載入的網頁文件。由於終端在渲染網頁之前執行的上述步驟需要消耗終端一定的處理資源,在一定程度上影響終端的性能。 Before the terminal renders the webpage, the media query method is needed to determine the webpage style adapted to the device information of the terminal and the webpage file to be loaded by rendering the webpage style, and select the current required from the webpage file returned by the server. Loaded web page file. Since the above steps performed by the terminal before rendering the webpage need to consume certain processing resources of the terminal, the performance of the terminal is affected to some extent.

本發明實施例的目的是提供一種網頁文件發送方法、網頁渲染方法及裝置、網頁渲染系統,以解決現有技術中存在的上述問題。 An object of the present invention is to provide a webpage file sending method, a webpage rendering method and apparatus, and a webpage rendering system to solve the above problems in the prior art.

為解決上述技術問題,本發明實施例提供的網頁文件發送方法、網頁渲染方法及裝置、網頁渲染系統是這樣實現的:一種網頁文件發送方法,包括:伺服器接收終端發送的攜帶與所述終端對應的使用者代理資訊的網頁請求; 所述伺服器根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊;所述伺服器獲取與所述設備資訊對應的網頁文件並向所述終端發送。 To solve the above technical problem, the webpage file sending method, the webpage rendering method and apparatus, and the webpage rendering system provided by the embodiment of the present invention are implemented as follows: a webpage file sending method includes: a server receiving terminal carrying the port and the terminal a web page request for the corresponding user agent information; The server determines device information of the terminal corresponding to the user agent information according to the user agent information; the server acquires a webpage file corresponding to the device information and sends the file to the terminal.

一種網頁渲染方法,包括:終端向伺服器發送攜帶與所述終端對應的使用者代理資訊的網頁請求;所述終端接收所述伺服器返回的與所述終端的設備資訊對應的網頁文件;所述設備資訊是所述伺服器根據所述使用者代理資訊確定的;所述終端利用與所述設備資訊對應的網頁文件進行網頁的渲染。 A webpage rendering method includes: the terminal sends a webpage request carrying the user agent information corresponding to the terminal to the server; the terminal receives the webpage file corresponding to the device information of the terminal returned by the server; The device information is determined by the server according to the user agent information; the terminal performs rendering of the webpage by using a webpage file corresponding to the device information.

一種網頁文件發送裝置,包括:接收單元,確定單元,獲取單元及發送單元;所述接收單元接收終端發送的攜帶與所述終端對應的使用者代理資訊的網頁請求;所述確定單元根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊;所述獲取單元獲取與所述設備資訊對應的網頁文件;所述發送單元向所述終端發送與所述設備資訊對應的網頁文件。 A webpage file transmitting apparatus, comprising: a receiving unit, a determining unit, an obtaining unit, and a sending unit; the receiving unit receiving a webpage request sent by the terminal and carrying user agent information corresponding to the terminal; the determining unit according to the User agent information, determining device information of the terminal corresponding to the user agent information; the obtaining unit acquiring a webpage file corresponding to the device information; the sending unit sending the device to the terminal The web page file corresponding to the information.

一種網頁渲染裝置,包括:發送單元,接收單元和渲染單元;所述發送單元向伺服器發送攜帶與終端對應的使用者代理資訊的網頁請求;所述接收單元接收所述伺服器返回的與所述終端的設備資訊對應的網頁文件;所述設備資訊是所述伺服器根據所述使用者代理資訊確定的;所述 渲染單元利用與所述設備資訊對應的網頁文件進行網頁的渲染。 A webpage rendering apparatus includes: a sending unit, a receiving unit, and a rendering unit; the sending unit sends a webpage request carrying user agent information corresponding to the terminal to the server; and the receiving unit receives the information returned by the server a webpage file corresponding to the device information of the terminal; the device information is determined by the server according to the user agent information; The rendering unit performs rendering of the webpage by using a webpage file corresponding to the device information.

一種網頁渲染系統,包括伺服器、第一資料庫和第二資料庫,所述第一資料庫儲存有使用者代理資訊與設備資訊的映射關係,所述第二資料庫儲存有與設備資訊對應的網頁文件,所述伺服器接收終端發送的攜帶使用者代理資訊的網頁請求,並從所述第一資料庫中查詢與所述網頁請求中攜帶的使用者代理資訊對應的設備資訊,所述伺服器從所述第二資料庫獲取與所述設備資訊對應的網頁文件,並將獲取的所述網頁文件發送至終端。 A webpage rendering system includes a server, a first database, and a second database, wherein the first database stores a mapping relationship between user agent information and device information, and the second database stores information corresponding to device information. a webpage file, the server receiving a webpage request that is sent by the terminal and carrying the user agent information, and querying the first database for device information corresponding to the user agent information carried in the webpage request, The server obtains a webpage file corresponding to the device information from the second database, and sends the obtained webpage file to the terminal.

本發明實施例採用的上述至少一個技術方案能夠達到以下有益效果: The above at least one technical solution adopted by the embodiment of the present invention can achieve the following beneficial effects:

在終端請求網頁的過程中,伺服器根據終端發送的網頁請求所攜帶的使用者代理資訊,確定與該使用者代理資訊對應的所述終端的設備資訊,根據設備資訊確定與之對應的各種網頁文件並向終端發送,以使得終端利用與設備資訊對應的上述網頁文件進行網頁的渲染。相較於現有技術,在網頁渲染之前,確定終端的設備資訊並確定與設備資訊對應的網頁文件均是由伺服器來執行的,避免了由終端執行上述過程,從而避免因終端執行上述步驟而過多消耗終端的處理資源的問題,提升終端的性能。 In the process of requesting the webpage by the terminal, the server determines the device information of the terminal corresponding to the user agent information according to the user agent information carried by the webpage request sent by the terminal, and determines various webpages corresponding to the device according to the device information. The file is sent to the terminal, so that the terminal uses the webpage file corresponding to the device information to perform rendering of the webpage. Compared with the prior art, before the webpage is rendered, determining the device information of the terminal and determining that the webpage file corresponding to the device information is executed by the server, the execution of the foregoing process by the terminal is avoided, thereby avoiding the terminal performing the above steps. Excessive consumption of processing resources of the terminal, improving the performance of the terminal.

S101‧‧‧步驟 S101‧‧‧Steps

S102‧‧‧步驟 S102‧‧‧Steps

S103‧‧‧步驟 S103‧‧‧Steps

S103‧‧‧步驟 S103‧‧‧Steps

10‧‧‧終端 10‧‧‧ Terminal

20‧‧‧終端 20‧‧‧ Terminal

S201‧‧‧步驟 S201‧‧‧ steps

S202‧‧‧步驟 S202‧‧‧Steps

S203‧‧‧步驟 S203‧‧‧Steps

S204‧‧‧步驟 S204‧‧‧Steps

S205‧‧‧步驟 S205‧‧‧Steps

S206‧‧‧步驟 S206‧‧‧ steps

S207‧‧‧步驟 S207‧‧‧Steps

100‧‧‧終端 100‧‧‧ Terminal

101‧‧‧瀏覽器或使用者端 101‧‧‧ browser or user side

110‧‧‧網頁渲染裝置 110‧‧‧Web rendering device

111‧‧‧發送單元 111‧‧‧Send unit

113‧‧‧接收單元 113‧‧‧ Receiving unit

115‧‧‧渲染單元 115‧‧‧ rendering unit

200‧‧‧伺服器 200‧‧‧Server

210‧‧‧網頁文件發送裝置 210‧‧‧Web file sending device

211‧‧‧接收單元 211‧‧‧ receiving unit

213‧‧‧確定單元 213‧‧‧Determining unit

215‧‧‧獲取單元 215‧‧‧Acquisition unit

217‧‧‧發送單元 217‧‧‧Send unit

300‧‧‧第一資料庫 300‧‧‧First database

400‧‧‧第二資料庫 400‧‧‧Second database

為了更清楚地說明本發明實施例或現有技術中的技術 方案,下面將對實施例或現有技術描述中所需要使用的附圖作簡單地介紹,顯而易見地,下面描述中的附圖僅僅是本發明中記載的一些實施例,對於本領域普通技術人員來講,在不付出進步性勞動性的前提下,還可以根據這些附圖獲得其他的附圖。 In order to more clearly illustrate the embodiments of the present invention or the techniques in the prior art BRIEF DESCRIPTION OF THE DRAWINGS The accompanying drawings, which are used in the description of the embodiments of the present invention, will be briefly described below, and the drawings in the following description are merely some of the embodiments described in the present invention. In other words, other drawings can be obtained based on these drawings without paying progressive labor.

圖1為本發明一實施例提供的網頁請求過程的流程圖;圖2顯示了在不同終端上顯示不同的網頁樣式的實例;圖3為本發明一實施例提供的以伺服器為主體的網頁文件發送方法的流程圖;圖4為本發明一實施例提供的網頁渲染裝置和網頁文件發送裝置的示意圖。 1 is a flowchart of a webpage requesting process according to an embodiment of the present invention; FIG. 2 is a diagram showing an example of displaying different webpage styles on different terminals; FIG. 3 is a server-based webpage according to an embodiment of the present invention; A flowchart of a file sending method; FIG. 4 is a schematic diagram of a webpage rendering apparatus and a webpage file sending apparatus according to an embodiment of the present invention.

為了使本技術領域的人員更好地理解本發明中的技術方案,下面將結合本發明實施例中的附圖,對本發明實施例中的技術方案進行清楚、完整地描述,顯然,所描述的實施例僅僅是本發明一部分實施例,而不是全部的實施例。基於本發明中的實施例,本領域普通技術人員在沒有作出進步性勞動前提下所獲得的所有其他實施例,都應當屬於本發明保護的範圍。 In order to make those skilled in the art better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. The embodiments are only a part of the embodiments of the invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without departing from the present invention should fall within the scope of the present invention.

目前,網頁(Web)頁面可以在各種瀏覽器或使用者端或應用APP的使用者端中進行展示,而瀏覽器或使用 者端載入各種網頁文件、並利用所述網頁文件渲染網頁頁面的速度,直接影響著使用者的使用體驗。網頁頁面的渲染過程是指:瀏覽器或使用者端根據CSS(Cascading Style Sheets,層疊樣式表)定義的規則,將伺服器(Web伺服器或應用APP的服務端)返回的HTML(Hyper Text Mark-up Language,超文字標記語言)代碼顯示在瀏覽器或使用者端的視窗中的過程。 Currently, web pages can be displayed in various browsers or on the user side of the client or application app, while the browser or the browser The speed at which the user loads various web page files and renders the web page using the web page file directly affects the user experience. The rendering process of a web page refers to the HTML (Hyper Text Mark) returned by the server (the server of the web server or the application APP) according to the rules defined by the CSS (Cascading Style Sheets). -up Language, the process of displaying code in a browser or user-side window.

針對現有技術中存在的伺服器可能將部分不需被載入的網頁文件返回至所述終端的問題,本文提出如下技術方案以至少解決這一問題。 In view of the problem that the server existing in the prior art may return part of the webpage file that does not need to be loaded to the terminal, the following technical solutions are proposed to solve at least this problem.

圖1為本發明一實施例提供的網頁請求的過程,該過程由終端和伺服器來共同完成,使用者藉由在所述終端上的瀏覽器或使用者端中輸入某網址(功能變數名稱)來請求存取某網頁,所述伺服器是與上述終端所請求存取的網址對應的伺服器。本實施例中,上述網頁請求過程包括如下步驟: FIG. 1 is a process of requesting a webpage according to an embodiment of the present invention. The process is performed by a terminal and a server. The user inputs a certain web address by using a browser or a user end on the terminal. To request access to a web page, the server is a server corresponding to the web address requested by the terminal. In this embodiment, the foregoing webpage request process includes the following steps:

步驟S101:終端向伺服器發送攜帶與所述終端對應的使用者代理資訊的網頁請求。 Step S101: The terminal sends a webpage request carrying the user agent information corresponding to the terminal to the server.

一般地,使用者可以藉由在終端的瀏覽器或使用者端中輸入網址來請求存取某網頁。在輸入網址之後,終端需要向與所述網址對應的伺服器發送網頁請求(即HTTP請求)。在發送上述網頁請求之前,瀏覽器或使用者端首先需要藉由網路與Web伺服器建立連接,該連接可以藉由TCP協定來完成的。一旦終端與伺服器建立了連接,則瀏 覽器或使用者端可以向伺服器發送網頁請求。所述網頁請求可以包括:請求方法URI協定/版本、請求頭(Request Header)資訊、請求正文。其中,請求頭資訊可包含一些與使用者端環境對應的資訊和與請求正文對應的資訊。例如,請求頭資訊可以聲明瀏覽器或使用者端所用的語言、請求正文的長度等。 Generally, the user can request access to a webpage by inputting a web address in a browser or a user terminal of the terminal. After entering the web address, the terminal needs to send a web page request (ie, an HTTP request) to a server corresponding to the web address. Before sending the above webpage request, the browser or the user first needs to establish a connection with the web server through the network, and the connection can be completed by using a TCP protocol. Once the terminal has established a connection with the server, then The browser or the client can send a web page request to the server. The webpage request may include: a request method URI agreement/version, a request header (Request Header) information, and a request body. The request header information may include some information corresponding to the user end environment and information corresponding to the request body. For example, the request header information can declare the language used by the browser or the client, the length of the request body, and the like.

以下是一個網頁請求的例子:GET/sample.jspHTTP/1.1 Accept:image/gif.image/jpeg,*/* Accept-Language:zh-cn Connection:Keep-Alive Host:localhost User-Agent:Mozila/4.0(compatible;MSIE5.01;Window NT5.0) Accept-Encoding:gzip,deflate username=jinqiao&password=1234 The following is an example of a web page request: GET/sample.jspHTTP/1.1 Accept:image/gif.image/jpeg,*/* Accept-Language:zh-cn Connection:Keep-Alive Host:localhost User-Agent:Mozila/4.0 (compatible; MSIE5.01; Window NT5.0) Accept-Encoding: gzip, deflate username=jinqiao&password=1234

在以上例子中,網頁請求的第一行是“方法URL議/版本”:GET/sample.jsp HTTP/1.1;請求頭(Request Header)資訊是:Accept:image/gif.image/jpeg.*/* Accept-Language:zh-cn Connection:Keep-Alive Host:localhost User-Agent:Mozila/4.0(compatible:MSIE5.01:Windows NT5.0) Accept-Encoding:gzip,deflate In the above example, the first line of the web page request is "method URL discussion/version": GET/sample.jsp HTTP/1.1; the request header (Request Header) information is: Accept:image/gif.image/jpeg.*/ * Accept-Language: zh-cn Connection: Keep-Alive Host: localhost User-Agent: Mozila/4.0 (compatible: MSIE5.01: Windows NT5.0) Accept-Encoding: gzip, deflate

請求頭資訊和請求正文之間一般可以空一行,表示請求頭資訊已經結束,接下來的是請求正文。在上述例子中,請求正文可以包含使用者提交的查詢字串資訊:username=jinqiao&password=1234。在以上例子中,請求正文只有一行內容。當然,在實際應用中,請求正文可以包含更多的內容。 A line can usually be blank between the request header information and the request body, indicating that the request header information has ended, followed by the request body. In the above example, the request body may contain the query string information submitted by the user: username=jinqiao&password=1234. In the above example, the request body has only one line of content. Of course, in practical applications, the request body can contain more content.

本發明實施例中,上述網頁請求包括使用者代理(User-Agent,UA)資訊,使用者代理資訊是指上述終端的瀏覽器或使用者端所特有的標識資訊,包括:硬體平臺、系統軟體、應用軟體和使用者個人偏好等。一種行動終端的使用者代理資訊的實例如下:Mozilla/5.0(Linux;U;Android 4.1.1;zh-cn;GT-I9100 Build/JRO03H;CyanogenMod-10)AppleWebKit/534.30(KHTML,like Gecko)Version/4.0 Mobile Safari/534.30 In the embodiment of the present invention, the webpage request includes user-agent (UA) information, and the user agent information refers to the identifier information unique to the browser or the user end of the terminal, including: a hardware platform and a system. Software, application software, and user preferences. An example of user agent information for a mobile terminal is as follows: Mozilla/5.0 (Linux; U; Android 4.1.1; zh-cn; GT-I9100 Build/JRO03H; CyanogenMod-10) AppleWebKit/534.30 (KHTML, like Gecko) Version /4.0 Mobile Safari/534.30

步驟S102:伺服器根據所述使用者代理資訊,確定與所述使用者代理資訊對應的設備資訊。 Step S102: The server determines device information corresponding to the user agent information according to the user agent information.

在網頁請求的過程中,對於具備不同設備資訊的終端,所需渲染的網頁樣式也不盡相同,也就是說,最終在終端的瀏覽器或使用者端上渲染形成的網頁樣式需要依據該終端的設備資訊來確定。本發明實施例中,需要伺服器在接收到上述網頁請求之後,確定與發送上述網頁請求的終端對應的設備資訊。關於所述設備資訊,包括但不限於:終端的顯示器資訊、終端的其他硬體資訊、終端的作 業系統資訊等。其中,上述顯示器資訊可以包括螢幕的解析度資訊、或像素密度資訊、或螢幕的大小等。總之,根據終端的設備資訊,可以渲染得到與所述設備資訊相適配的網頁樣式。 In the process of requesting a webpage, for a terminal having different device information, the style of the webpage to be rendered is not the same, that is, the style of the webpage finally rendered on the browser or the user end of the terminal needs to be based on the terminal. Device information to determine. In the embodiment of the present invention, after the server receives the webpage request, the server determines the device information corresponding to the terminal that sends the webpage request. Information about the device, including but not limited to: display information of the terminal, other hardware information of the terminal, and work of the terminal Industry system information, etc. The display information may include resolution information of the screen, or pixel density information, or the size of the screen. In summary, according to the device information of the terminal, a webpage style adapted to the device information can be rendered.

圖2顯示了在不同終端上顯示不同的網頁樣式的實例。在該圖2中,終端10、20分別具有不同的設備資訊,例如螢幕的解析度不同。其中,假設某網頁包括網頁模組A、B、C,所述網頁模組可以例如是圖片、文字、按鍵等。可以看出,在終端10、20請求該網頁時,所渲染得到的網頁樣式可以不相同,不同的網頁樣式可以體現在文字的大小,網頁模組的位置和佈局,等等。 Figure 2 shows an example of displaying different web page styles on different terminals. In FIG. 2, the terminals 10, 20 respectively have different device information, for example, the resolution of the screen is different. The webpage module includes a webpage module A, B, and C. The webpage module may be, for example, a picture, a text, a button, or the like. It can be seen that when the terminal 10, 20 requests the webpage, the rendered webpage styles may be different, and different webpage styles may be reflected in the size of the text, the location and layout of the webpage module, and the like.

本發明一實施例中,在上述步驟S102之前,所述方法還包括如下步驟: In an embodiment of the present invention, before the step S102, the method further includes the following steps:

伺服器預先產生使用者代理資訊和設備資訊的映射關係,產生的映射關係可以儲存於Web伺服器的資料庫中。 The server pre-generates the mapping relationship between the user agent information and the device information, and the generated mapping relationship can be stored in the database of the web server.

舉例而言:與使用者代理資訊:“Mozilla/5.0(Linux;U;Android 4.1.1;zh-cn;GT-I9100 Build/JRO03H;CyanogenMod-10)AppleWebKit/534.30(KHTML,like Gecko)Version/4.0 Mobile Safari/534.30”相映射的設備資訊為:480px*800px;與使用者代理資訊:“Mozilla/5.0(Windows;U;Windows NT 5.1;en-US;rv:0.9.4)Gecko/20011128 Netscape6/6.2.1”相映射的設備資訊為:1920px*1080px;等等。 For example: with user agent information: "Mozilla/5.0 (Linux; U; Android 4.1.1; zh-cn; GT-I9100 Build / JRO03H; CyanogenMod-10) AppleWebKit / 534.30 (KHTML, like Gecko) Version / 4.0 Mobile Safari/534.30” mapped device information: 480px*800px; and user agent information: “Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: 0.9.4) Gecko/20011128 Netscape6 /6.2.1" The device information for phase mapping is: 1920px*1080px; and so on.

相應地,上述步驟S102具體包括:伺服器根據預先產生的使用者代理資訊和設備資訊的映射關係,查找與所述使用者代理資訊相映射的所述終端的設備資訊。 Correspondingly, the step S102 includes: the server searching for device information of the terminal that is mapped with the user agent information according to a mapping relationship between the user agent information and the device information generated in advance.

藉由上述方法,伺服器在接收到終端(瀏覽器或使用者端)發送的網頁請求之後,可以從該網頁請求中提取所攜帶的使用者代理資訊,並依據該使用者代理資訊查找預先形成的資料庫,以查找到與該使用者代理資訊相映射的設備資訊。一般地,資料庫中針對每一個使用者代理資訊,會存在唯一與該使用者代理資訊相映射的設備資訊(如顯示器資訊)。當然,也存在因資料庫中沒有存在相應的記錄,而導致無法查找到與當前使用者代理資訊相映射的設備資訊的可能性,對於這一情況,將在下文具體介紹解決方案。 After receiving the webpage request sent by the terminal (browser or user end), the server may extract the carried user agent information from the webpage request, and search for the pre-formed according to the user proxy information. The database to find device information mapped to the user agent information. Generally, for each user agent information in the database, there will be unique device information (such as display information) mapped to the user agent information. Of course, there is also the possibility that the device information that is mapped to the current user agent information cannot be found because there is no corresponding record in the database. For this case, the solution will be specifically described below.

值得一提的是,本發明其他實施例中,在上述步驟S102之前,所述方法還可以包括如下步驟: It is to be noted that, in other embodiments of the present invention, before the step S102, the method may further include the following steps:

伺服器將設備資訊和特徵資訊的映射關係進行儲存;其中,所述特徵資訊是所述使用者代理資訊中包含的。上述特徵資訊可以是如下任意一種:設備品牌型號資訊、設備的作業系統資訊等。舉例來說,一條使用者代理資訊是:Mozilla/5.0(Linux;U;Android 4.1.1;zh-cn;GT-I9100 Build/JRO03H;CyanogenMod-10)AppleWebKit/534.30(KHTML,like Gecko)Version/4.0 Mobile Safari/534.30,則設備品牌型號資訊為:“GT-I9100”,設備的作業系統資 訊為:“Android 4.1.1”。需要說明的是,上述設備資訊和特徵資訊的映射關係可以是由伺服器預先產生的。或者,由伺服器藉由自學習過程逐漸產生。再或者,由管理員來配置上述設備資訊和特徵資訊的映射關係(即不一定由伺服器產生)。 The server stores the mapping relationship between the device information and the feature information; wherein the feature information is included in the user agent information. The above characteristic information may be any one of the following: device brand model information, equipment operating system information, and the like. For example, a user agent information is: Mozilla/5.0 (Linux; U; Android 4.1.1; zh-cn; GT-I9100 Build/JRO03H; CyanogenMod-10) AppleWebKit/534.30 (KHTML, like Gecko) Version/ 4.0 Mobile Safari/534.30, the device brand model information is: "GT-I9100", the operating system of the equipment The news is: "Android 4.1.1". It should be noted that the mapping relationship between the device information and the feature information may be pre-generated by the server. Or, it is gradually generated by the server through a self-learning process. Or, the administrator configures the mapping relationship between the device information and the feature information (that is, not necessarily generated by the server).

相應地,以上步驟S102可以具體包括如下步驟: Correspondingly, the above step S102 may specifically include the following steps:

伺服器提取所述使用者代理資訊中包含的特徵資訊;伺服器根據預先產生的設備資訊和特徵資訊的映射關係,確定與所述特徵資訊對應的所述終端的設備資訊。另外,伺服器可以藉由分析使用者代理資訊,得到與使用者代理資訊對應的設備資訊。例如,伺服器藉由提取使用者代理資訊中所攜帶的設備品牌型號資訊:“GT-I9100”,便可以確定與“GT-I9100”對應的設備資訊(如:螢幕的像素資訊是:480px*800px,螢幕尺寸資訊是:4.3英寸);再例如,伺服器藉由提取使用者代理資訊中所攜帶的作業系統資訊:“Android 4.1.1”,便可以確定與“Android 4.1.1”對應的設備資訊的一個可能的範圍區間(如:螢幕的大小是:3.0~5.3英寸,螢幕的像素資訊是:(480px~800px)*(800px~1280px))。 The server extracts the feature information included in the user agent information; the server determines the device information of the terminal corresponding to the feature information according to the mapping relationship between the device information and the feature information generated in advance. In addition, the server can obtain device information corresponding to the user agent information by analyzing the user agent information. For example, the server can determine the device information corresponding to the “GT-I9100” by extracting the device brand model information carried in the user agent information: “GT-I9100” (eg, the pixel information of the screen is: 480px*) 800px, the screen size information is: 4.3 inches); for example, the server can determine the corresponding operation information of "Android 4.1.1" by extracting the operating system information carried in the user agent information: "Android 4.1.1" A possible range of device information (eg, the size of the screen is: 3.0 to 5.3 inches, and the pixel information of the screen is: (480px~800px)*(800px~1280px)).

步驟S103:伺服器獲取與設備資訊對應的網頁文件並向所述終端發送。 Step S103: The server acquires a webpage file corresponding to the device information and sends the webpage file to the terminal.

所述網頁文件可以包括:HTML文件,CSS文件,JS(JavaScript)文件,圖片,等等。網頁頁面一般是基於上述各種網頁文件來進行渲染的。另外,上述網頁文件也 可以稱為網頁資源,該網頁資源可以包括靜態資源和動態資源。 The web page file may include: an HTML file, a CSS file, a JS (JavaScript) file, a picture, and the like. Web pages are generally rendered based on the various web page files described above. In addition, the above webpage file is also It can be referred to as a web resource, and the web resource can include a static resource and a dynamic resource.

本發明實施例中,在上述步驟S103之前,所述方法還包括如下步驟: In the embodiment of the present invention, before the step S103, the method further includes the following steps:

a)所述伺服器根據所述設備資訊,確定與所述設備資訊對應的網頁文件的文件標識,其中,所述文件標識可以例如是網頁文件的URL(Uniform Resource Locator,統一資源定位符)或者文件名,所述URL例如:*圖片:“HTTP://static.ak.fbcdn.net/rsrc.php/z12E0/hash/8q2anwu7.gif” “HTTP://static.ak.fbcdn.net/rsrc.php/zBS5C/hash/7hwy7at6.gif” *CSS文件:“HTTP://static.ak.fbcdn.net/rsrc.php/z448Z/hash/2plh8s4n.css” “HTTP://static.ak.fbcdn.net/rsrc.php/zANE1/hash/cvtutcee.css” *JS文件:“HTTP://static.ak.fbcdn.net/rsrc.php/ZEMOA/hash/c8yzb6ub.js” “HTTP://static.ak.fbcdn.net/rsrc.php/z6R9L/hash/cq2lgbs8.js” a) the server determines, according to the device information, a file identifier of a webpage file corresponding to the device information, where the file identifier may be, for example, a URL of a webpage file (Uniform Resource Locator) or File name, the URL is for example: * Image: "http://static.ak.fbcdn.net/rsrc.php/z12E0/hash/8q2anwu7.gif" "http://static.ak.fbcdn.net/rsrc .php/zBS5C/hash/7hwy7at6.gif" *CSS file: "http://static.ak.fbcdn.net/rsrc.php/z448Z/hash/2plh8s4n.css" "http://static.ak.fbcdn .net/rsrc.php/zANE1/hash/cvtutcee.css” *JS file: “http://static.ak.fbcdn.net/rsrc.php/ZEMOA/hash/c8yzb6ub.js” “HTTP://static .ak.fbcdn.net/rsrc.php/z6R9L/hash/cq2lgbs8.js"

又例如:當終端螢幕的解析度的寬度(即設備資訊)是400px時,確定與該設備資訊對應的CSS文件(網頁文件之一)的文件名(即文件標識)為:“400.css”;當終端螢幕的解析度的寬度(即設備資訊)是800px時,確定與該設備資訊對應的CSS文件的文件名(即文件標識)為:“800.css”。 For another example, when the width of the resolution of the terminal screen (ie, the device information) is 400px, the file name (ie, the file identifier) of the CSS file (one of the webpage files) corresponding to the device information is determined as: “400.css” When the width of the resolution of the terminal screen (ie, device information) is 800px, it is determined that the file name (ie, file identifier) of the CSS file corresponding to the device information is: "800.css".

b)所述伺服器向所述終端發送包含所述文件標識的 文件(即HTML文件)。 b) the server sends the file identifier to the terminal File (ie HTML file).

一般地,伺服器(Web伺服器或應用APP的服務端)在接收到終端的網頁請求後,回應於終端發送的網頁請求(HTTP請求),需要向終端返回相應的HTTP回應(HTTP Response),所述HTTP回應(即上述HTML文件)可以包括:協定狀態版本代碼描述資訊,回應頭(Response Header)資訊及回應正文。其中,所返回的HTML回應可包括上述確定的文件標識,如,所需應用的CSS文件的URL或文件名,所需應用的圖片的URL,等等。其中,所述HTML文件可以只包含所述瀏覽器或使用者端在後續網頁渲染過程中所需要採用的網頁文件的文件標識。承上述例子,若當前終端的螢幕解析度是400px*800px,則渲染過程需要採用的CSS文件應該是“400.css”,伺服器返回的HTML文件應該包含:<link href=“400.css”/>這段資訊;若當前終端的螢幕解析度是800px*1280px,則渲染過程需要採用的CSS文件應該是“800.css”,伺服器返回的HTML文件應該包含:<link href=“800.css”/>這段資訊。也就是說,伺服器可以根據所確定的設備資訊的不同,向終端返回包含不同的網頁文件的文件標識的HTML文件,所返回的HTML文件中一般不包含其餘不需要被載入的網頁文件的文件標識。承上述例子,現有技術中,無論終端的螢幕解析度是“400px*800px”,還是“800px*1280px”,都需向所述終端返回上述CSS文件:“400.css”和“800.css”,對於螢幕解 析度為:“400px*800px”的終端而言,上述CSS文件:“800.css”是不需被載入的網頁文件(即無需在網頁渲染過程中使用的網頁文件)。相較於現有技術中,本發明實施例可以針對終端的螢幕解析度(設備資訊)的不同,有針對性地將與設備資訊對應的網頁文件返回至終端。 Generally, after receiving the webpage request of the terminal, the server (the server of the web server or the application APP) responds to the webpage request (HTTP request) sent by the terminal, and needs to return a corresponding HTTP response (HTTP Response) to the terminal. The HTTP response (ie, the HTML file above) may include: an agreement status version code description information, a response header (Response Header) information, and a response body. The returned HTML response may include the above identified file identifier, such as the URL or file name of the CSS file of the desired application, the URL of the image of the desired application, and the like. The HTML file may only include the file identifier of the webpage file that the browser or the user end needs to adopt in the subsequent webpage rendering process. According to the above example, if the current terminal resolution is 400px*800px, the CSS file to be used in the rendering process should be “400.css”, and the HTML file returned by the server should contain: <link href=“400.css” />This information; if the current terminal resolution is 800px*1280px, the CSS file to be used in the rendering process should be "800.css", and the HTML file returned by the server should contain: <link href="800. Css"/> This information. That is to say, the server may return an HTML file containing file identifiers of different webpage files to the terminal according to the determined device information, and the returned HTML file generally does not include the remaining webpage files that do not need to be loaded. File identification. According to the above example, in the prior art, whether the resolution of the terminal is "400px*800px" or "800px*1280px", the above CSS files need to be returned to the terminal: "400.css" and "800.css" For the screen solution For a terminal with a resolution of "400px*800px", the above CSS file: "800.css" is a webpage file that does not need to be loaded (ie, a webpage file that does not need to be used in the rendering process of the webpage). Compared with the prior art, the embodiment of the present invention can specifically return the webpage file corresponding to the device information to the terminal according to the difference of the screen resolution (device information) of the terminal.

相應地,基於上述內容,上述步驟S103具體包括如下步驟: Correspondingly, based on the above content, the foregoing step S103 specifically includes the following steps:

c)伺服器接收所述終端發送的攜帶所述文件標識的文件獲取請求。 c) The server receives the file acquisition request sent by the terminal and carries the file identifier.

一般,瀏覽器或使用者端在接收到伺服器返回的HTML文件之後,可以藉由向伺服器發送相應的文件獲取請求的方式,來獲取嵌入當前網頁樣式的各種網頁文件(如:CSS文件及圖片等),所述文件獲取請求攜帶網頁文件的URL。 Generally, after receiving the HTML file returned by the server, the browser or the client can obtain various webpage files (such as CSS files) embedded in the current webpage style by sending a corresponding file acquisition request to the server. Picture, etc.), the file acquisition request carries the URL of the web page file.

d)伺服器回應於所述文件獲取請求,向所述終端發送與所述文件標識對應的網頁文件。 d) The server sends a webpage file corresponding to the file identifier to the terminal in response to the file acquisition request.

值得說明的是,本發明其他實施例中,伺服器可以確定到與當前設備資訊對應的所需渲染的網頁樣式,並相應地獲取到當前網頁樣式所需應用到的各種網頁文件,並直接將獲取到的各種網頁文件返回到所述終端上進行網頁的渲染,也就是說,終端(瀏覽器或使用者端)在向伺服器發送上述HTTP請求之後,可以不用再向上述伺服器發送用以獲取各種網頁文件的文件獲取請求。 It should be noted that, in other embodiments of the present invention, the server may determine a webpage style to be rendered corresponding to the current device information, and obtain various webpage files to be applied to the current webpage style, and directly The obtained webpage files are returned to the terminal for rendering of the webpage, that is, after the terminal (browser or user end) sends the HTTP request to the server, the server may not be sent to the server. Get file access requests for various web page files.

步驟S104:終端接收與設備資訊對應的網頁文件, 並利用接收到的網頁文件進行網頁的渲染,以將相應的網頁樣式顯示於所述終端的螢幕上。由於網頁渲染過程屬於本領域所習知的技術,本文不再予以詳述。 Step S104: The terminal receives a webpage file corresponding to the device information, And using the received webpage file to render the webpage to display the corresponding webpage style on the screen of the terminal. Since the web page rendering process is a technique well known in the art, it will not be described in detail herein.

圖3為本發明一實施例提供的以伺服器為主體的網頁文件發送方法的流程圖。參照上述圖1所介紹的實施例,本發明一實施例中,若以伺服器的角度來實施本技術方案,該網頁文件發送方法包括如下步驟: FIG. 3 is a flowchart of a method for sending a webpage file with a server as a main body according to an embodiment of the present invention. Referring to the embodiment described in FIG. 1 above, in an embodiment of the present invention, if the technical solution is implemented from the perspective of a server, the method for sending a webpage file includes the following steps:

S201:伺服器接收終端發送的攜帶與終端對應的使用者代理資訊的網頁請求。 S201: The server receives a webpage request sent by the terminal and carries user agent information corresponding to the terminal.

S202:伺服器根據使用者代理資訊,確定與使用者代理資訊對應的終端的設備資訊。 S202: The server determines device information of the terminal corresponding to the user agent information according to the user agent information.

S204:伺服器獲取與所述設備資訊對應的網頁文件並向所述終端發送。 S204: The server acquires a webpage file corresponding to the device information and sends the webpage file to the terminal.

以上步驟S201可以參照上述步驟S101的內容,以上步驟S202可以參照上述步驟S102的內容,以上步驟S204可以參照上述步驟S103的內容,本文不再予以贅述。 The above step S201 can refer to the content of the above step S101. The above step S202 can refer to the content of the above step S102. The above step S204 can refer to the content of the above step S103, and details are not described herein again.

本發明可選的實施例中,上述網頁文件發送方法還包括: In an optional embodiment of the present invention, the method for sending a webpage file further includes:

步驟S203:判斷是否查找到與使用者代理資訊對應的設備資訊。若查找到,則進入步驟S204;若沒有查找到,則進入下述步驟S205。 Step S203: determining whether the device information corresponding to the user agent information is found. If it is found, the process proceeds to step S204; if not, the process proceeds to step S205 described below.

步驟S205:伺服器向終端返回與網頁請求對應的基本資源包。 Step S205: The server returns a basic resource package corresponding to the webpage request to the terminal.

所述基本資源包一般可以包括所有可能渲染的網頁樣式所需載入的各種網頁文件,也就是說,具有任何設備資訊的終端在接收到該基本資源包之後,均可以根據該基本資源包,選取到與自身設備資訊相適配的網頁樣式所需載入的網頁文件。終端在接收到上述基本資源包之後,可以採集到自身的設備資訊(如顯示器資訊),接著動態確定與自身的設備資訊相適合的網頁樣式,以及與該網頁樣式對應的所需載入的各種網頁文件,並從上述基本資源包內選取所需載入的網頁文件,最終利用選取的網頁文件進行網頁的渲染。 The basic resource package may generally include various webpage files that are required to be loaded by all possible rendered webpage styles, that is, a terminal having any device information may receive the basic resource bundle according to the basic resource bundle after receiving the basic resource bundle. Select the web page file to be loaded into the webpage style that matches the information of its own device. After receiving the basic resource package, the terminal may collect its own device information (such as display information), and then dynamically determine a webpage style suitable for its own device information, and various required loadings corresponding to the webpage style. The webpage file, and select the webpage file to be loaded from the basic resource package, and finally use the selected webpage file to render the webpage.

步驟S206:伺服器接收終端返回的與該終端對應的設備資訊和使用者代理資訊。其中,所述設備資訊是所述終端在利用所述基本資源包進行網頁載入時獲取到的。 Step S206: The server receives the device information and user agent information corresponding to the terminal returned by the terminal. The device information is obtained by the terminal when the webpage is loaded by using the basic resource package.

本實施例中,終端(瀏覽器或使用者端)在進行網頁渲染的同時,可以藉由一定的方法(如JavaScript)動態採集到當前終端的設備資訊,如:螢幕的解析度資訊,螢幕的像素密度資訊,螢幕的大小資訊,所採用的作業系統資訊,硬體平臺資訊等等。 In this embodiment, the terminal (browser or user end) can dynamically collect the device information of the current terminal by a certain method (such as JavaScript) while performing webpage rendering, such as: resolution information of the screen, screen Pixel density information, screen size information, operating system information, hardware platform information, etc.

步驟S207:伺服器產生返回的設備資訊和使用者代理資訊的映射關係並儲存。 Step S207: The server generates a mapping relationship between the returned device information and the user agent information and stores the information.

終端可向伺服器發送一攜帶上述設備資訊和使用者代理資訊的請求命令,以使得伺服器將採集到設備資訊和使用者代理資訊形成一定的映射關係,並儲存到資料庫中。藉由以上步驟S205~S207,可以在查詢不到與使用者代理 資訊對應的設備資訊時,藉由終端採集的方式,來對當前的資料庫(使用者代理資訊和設備資訊的對應關係)中的資料進行補充或完善,從而實現資料庫的“自學習過程”。藉由上述“自學習過程”,使得在伺服器後續查詢資料庫的過程中,就不會存在查找不到與使用者代理資訊對應的設備資訊的問題了,即總能查找到相匹配的結果,從而使得伺服器的執行效率能夠不斷提升。 The terminal may send a request command for carrying the device information and the user agent information to the server, so that the server forms a certain mapping relationship between the collected device information and the user agent information, and stores the information in the database. By the above steps S205~S207, the user agent can not be queried. When the device information corresponding to the information is used, the data in the current database (the correspondence between the user agent information and the device information) is supplemented or improved by the method of terminal collection, thereby realizing the "self-learning process" of the database. . Through the above-mentioned "self-learning process", in the process of the subsequent query of the database by the server, there is no problem that the device information corresponding to the user agent information cannot be found, that is, the matching result can always be found. Therefore, the execution efficiency of the server can be continuously improved.

上述圖3所介紹的實施例是從伺服器的角度說明了本發明的技術方案,實際上,本發明還可以從終端的角度進行實施,並同樣能夠解決上述問題。參照上述圖1所介紹的實施例,在本發明一實施例提供的一種網頁渲染方法,包括如下步驟: The embodiment described above with reference to Fig. 3 illustrates the technical solution of the present invention from the perspective of a server. In fact, the present invention can also be implemented from the perspective of a terminal, and the above problem can be solved as well. Referring to the embodiment introduced in FIG. 1 above, a webpage rendering method according to an embodiment of the present invention includes the following steps:

終端向伺服器發送攜帶與所述終端對應的使用者代理資訊的網頁請求。 The terminal sends a webpage request carrying the user agent information corresponding to the terminal to the server.

所述終端接收所述伺服器返回的與所述終端的設備資訊對應的網頁文件。其中,所述設備資訊是所述伺服器根據所述使用者代理資訊確定的。 The terminal receives a webpage file corresponding to the device information of the terminal returned by the server. The device information is determined by the server according to the user agent information.

終端利用與所述設備資訊對應的網頁文件進行網頁的渲染。 The terminal performs rendering of the webpage by using a webpage file corresponding to the device information.

承上所述,在上述各實施例提供的網頁文件發送方法、網頁渲染方法中,伺服器根據終端發送的網頁請求所攜帶的使用者代理資訊,確定與該使用者代理資訊對應的所述終端的設備資訊,根據設備資訊確定與之對應的各種網頁文件並向終端發送,以使得終端利用與設備資訊對應 的上述網頁文件進行網頁的渲染。相較於現有技術,由於伺服器在向終端返回網頁渲染過程所需的網頁文件之前,需要確定終端的設備資訊,並獲取與該設備資訊對應的網頁文件,從而使得最終伺服器向終端返回的是網頁渲染過程所需的網頁文件,而避免將其他不需被載入的網頁文件返回至上述終端,在一定程度上,可以降低對網路資源的消耗。 As described above, in the webpage file sending method and the webpage rendering method provided by the foregoing embodiments, the server determines the terminal corresponding to the user agent information according to the user agent information carried by the webpage request sent by the terminal. Device information, determining various webpage files corresponding to the device information according to the device information and transmitting to the terminal, so that the terminal uses the device information corresponding to the device The above webpage file is used to render the webpage. Compared with the prior art, before the server returns the webpage file required by the webpage rendering process to the terminal, the device information of the terminal needs to be determined, and the webpage file corresponding to the device information is obtained, so that the final server returns to the terminal. It is a webpage file required by the webpage rendering process, and avoids returning other webpage files that do not need to be loaded to the above terminal, and to a certain extent, can reduce the consumption of network resources.

另一方面,在現有技術中,由於終端(瀏覽器或使用者端)一般需要採集到自身的設備資訊,並利用媒體查詢(Media Query)方法,來確定與當前設備資訊所對應的網頁樣式及該網頁樣式所需載入的各種網頁文件,並從伺服器返回的網頁文件中,選取所需載入的各種網頁文件。可以看出,現有技術中除了存在增加了額外的、冗余的資源下載成本(即額外消耗網路資源),造成載入性能不佳的問題之外,還存在如下問題:終端在進行網頁渲染之前,需要確定自身的設備資訊,還需要利用媒體查詢方法判斷所需載入的網頁文件,並從伺服器返回的網頁文件中選取所需載入的網頁文件,一定程度上,終端執行上述步驟的過程均需要消耗自身的處理資源。也就是說,在網頁渲染的過程中,終端還需要考慮該以何種網頁樣式進行渲染,需要應用到哪些網頁條件,這勢必會影響到瀏覽器或使用者端渲染網頁的性能,降低網頁回應的速度。可見,藉由本發明實施例提供的上述方法,在網頁渲染之前,確定終端的設備資訊並確定與設備資訊對應的網頁文件均是 由伺服器來執行的,避免了由終端執行上述過程,從而避免因終端執行上述步驟而過多消耗終端的處理資源的問題,進而提升終端渲染網頁的性能,提升網頁回應的速度。 On the other hand, in the prior art, since the terminal (browser or user end) generally needs to collect its own device information, and uses a Media Query method to determine the web page style corresponding to the current device information and The webpage style needs to load various webpage files, and select various webpage files to be loaded from the webpage file returned by the server. It can be seen that in addition to the problem that the additional and redundant resource downloading cost (that is, the additional consumption of network resources) is added in the prior art, resulting in poor loading performance, the following problems exist: the terminal is performing webpage rendering. Before, you need to determine your own device information. You also need to use the media query method to determine the web page file to be loaded, and select the web page file to be loaded from the web page file returned by the server. To some extent, the terminal performs the above steps. All processes need to consume their own processing resources. That is to say, in the process of rendering the webpage, the terminal also needs to consider which webpage style to render, which webpage conditions need to be applied, which will inevitably affect the performance of the webpage rendered by the browser or the user end, and reduce the webpage response. speed. It can be seen that, by using the foregoing method provided by the embodiment of the present invention, before the webpage is rendered, determining device information of the terminal and determining that the webpage file corresponding to the device information is Executed by the server, the above process is avoided by the terminal, thereby avoiding the problem of excessively consuming the processing resources of the terminal due to the terminal performing the above steps, thereby improving the performance of the terminal rendering the webpage and improving the response speed of the webpage.

需要說明的是,以上各實施例所提供方法的各步驟的執行主體均可以是同一設備,或者,該方法也由不同設備作為執行主體。例如,步驟S201和步驟S202的執行主體可以為設備1,步驟S203的執行主體可以為設備2;又例如,步驟S201的執行主體可以為設備1,步驟S202和步驟S203的執行主體可以為設備2;等等。 It should be noted that the execution bodies of the steps of the methods provided by the foregoing embodiments may all be the same device, or the method may also be performed by different devices. For example, the execution body of step S201 and step S202 may be device 1, and the execution body of step S203 may be device 2; for example, the execution body of step S201 may be device 1, and the execution body of step S202 and step S203 may be device 2 ;and many more.

圖4為本發明一實施例提供的網頁渲染裝置和網頁文件發送裝置的示意圖。參照圖4所示,本發明一實施例中,終端100包括瀏覽器或使用者端101,網頁渲染裝置110,伺服器200包括網頁文件發送裝置210,其中,所述網頁渲染裝置110和上述網頁文件發送裝置210可以分別以軟體、或硬體或軟硬體結合的方式存在於上述終端100、上述伺服器200中。上述伺服器200和上述終端100可以藉由網路相互通訊。其中,上述終端100、伺服器200可以包括顯示幕、處理單元、記憶體、非揮發性記憶體、匯流排、輸入輸出裝置等硬體。除上述硬體外,上述終端100和伺服器200還包括相應的軟體。需要說明的是,上述網頁渲染裝置中的各個單元所能夠實現的功能與以上介紹的網頁渲染方法中各個步驟所能夠實現的功能類似,故該網頁渲染裝置的具體細節可以參照上述網頁渲染 方法實施例的內容,本文不再予以贅述。同樣地,上述網頁文件發送裝置的具體細節可以參照上述網頁文件發送方法實施例的內容。 FIG. 4 is a schematic diagram of a webpage rendering apparatus and a webpage file sending apparatus according to an embodiment of the present invention. Referring to FIG. 4, in an embodiment of the present invention, the terminal 100 includes a browser or a client 101, a webpage rendering device 110, and the server 200 includes a webpage file sending device 210, wherein the webpage rendering device 110 and the webpage are The file transmitting device 210 may be present in the terminal 100 and the server 200 in a combination of software or hardware or hardware and software. The server 200 and the terminal 100 can communicate with each other through a network. The terminal 100 and the server 200 may include hardware such as a display screen, a processing unit, a memory, a non-volatile memory, a bus bar, and an input/output device. In addition to the above hard body, the terminal 100 and the server 200 described above further include corresponding software. It should be noted that the functions that can be implemented by each unit in the webpage rendering apparatus are similar to those of the steps in the webpage rendering method described above. Therefore, the specific details of the webpage rendering apparatus can be referred to the above webpage rendering. The content of the method embodiment is not described herein again. Similarly, the specific details of the webpage file transmitting apparatus may refer to the content of the embodiment of the webpage file transmitting method.

參照圖4所示,本發明實施例中,網頁文件發送裝置210包括:接收單元211,確定單元213,獲取單元215及發送單元217。其中,所述接收單元211接收終端100的發送單元111所發送的攜帶與終端100對應的使用者代理資訊的網頁請求;所述確定單元213根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊;所述獲取單元215獲取與所述設備資訊對應的網頁文件;所述發送單元217向所述終端發送與所述設備資訊對應的網頁文件。其中,上述確定單元213可以藉由查找第一資料庫300的方式,來查找與使用者代理資訊對應耳的設備資訊,以上第一資料庫300可以預先儲存有使用者代理資訊和設備資訊的映射關係。另外,上述獲取單元215可以藉由向第二資料庫400發送請求的方式來獲取各種網頁文件,所發送的請求可以是攜帶設備資訊的HTTP頭資訊。上述第二資料庫400可以存放於各種網頁文件(資源),如:HTML文件、CSS文件、圖片、JS文件等等,所述第二資料庫400中存放的各種網頁文件與設備資訊進行映射,這樣,上述獲取單元215便可以根據當前確定的設備資訊,來從該第二資料庫400中獲取與設備資訊對應的各種網頁文件。 Referring to FIG. 4, in the embodiment of the present invention, the webpage file sending apparatus 210 includes: a receiving unit 211, a determining unit 213, an obtaining unit 215, and a sending unit 217. The receiving unit 211 receives a webpage request that is sent by the sending unit 111 of the terminal 100 and carries user agent information corresponding to the terminal 100. The determining unit 213 determines the user with the user according to the user agent information. The device information of the terminal corresponding to the proxy information; the obtaining unit 215 acquires a webpage file corresponding to the device information; and the sending unit 217 sends a webpage file corresponding to the device information to the terminal. The determining unit 213 can search for the device information corresponding to the user agent information by searching the first database 300. The first database 300 can store the mapping of the user agent information and the device information in advance. relationship. In addition, the obtaining unit 215 may obtain various webpage files by sending a request to the second database 400, and the sent request may be HTTP header information carrying device information. The second database 400 can be stored in various webpages (resources), such as HTML files, CSS files, images, JS files, etc., and various webpage files stored in the second database 400 are mapped with device information. In this way, the obtaining unit 215 can obtain various webpage files corresponding to the device information from the second database 400 according to the currently determined device information.

利用上述網頁文件發送裝置,本發明實施例可以至少 達到如下技術效果: With the above webpage file transmitting apparatus, the embodiment of the present invention can at least The following technical effects are achieved:

相較於現有技術,由於伺服器在向終端返回網頁渲染過程所需的網頁文件之前,需要確定終端的設備資訊,並獲取與該設備資訊對應的網頁文件,從而使得最終伺服器向終端返回的是網頁渲染過程所需的網頁文件,而避免將其他不需被載入的網頁文件返回至上述終端,在一定程度上,可以降低對網路資源的消耗。另外,藉由本發明實施例提供的上述方法,在網頁渲染之前,確定終端的設備資訊並確定與設備資訊對應的網頁文件均是由伺服器來執行的,避免了由終端執行上述過程,從而避免因終端執行上述步驟而過多消耗終端的處理資源的問題,進而提升終端渲染網頁的性能,提升網頁回應的速度。 Compared with the prior art, before the server returns the webpage file required by the webpage rendering process to the terminal, the device information of the terminal needs to be determined, and the webpage file corresponding to the device information is obtained, so that the final server returns to the terminal. It is a webpage file required by the webpage rendering process, and avoids returning other webpage files that do not need to be loaded to the above terminal, and to a certain extent, can reduce the consumption of network resources. In addition, by the foregoing method provided by the embodiment of the present invention, before the webpage is rendered, determining device information of the terminal and determining that the webpage file corresponding to the device information is executed by the server, thereby avoiding performing the foregoing process by the terminal, thereby avoiding Because the terminal performs the above steps, the problem of processing resources of the terminal is excessively consumed, thereby improving the performance of the terminal rendering the webpage and improving the response speed of the webpage.

本發明可選的實施例中,所述網頁文件發送裝置210還包括:產生單元,預先產生使用者代理資訊和設備資訊的映射關係;則,所述確定單元213根據預先產生的使用者代理資訊和設備資訊的映射關係,查找與所述使用者代理資訊相映射的所述終端的設備資訊;在另一實施例中,所述網頁文件發送裝置210還包括:產生單元,預先產生設備資訊和特徵資訊的映射關係;其中,所述特徵資訊是所述使用者代理資訊中包含的; 則,所述確定單元213包括:資訊提取單元和資訊查詢單元;所述資訊提取單元提取所述使用者代理資訊中包含的特徵資訊;所述資訊查詢單元根據預先產生的設備資訊和特徵資訊的映射關係,確定與所述特徵資訊對應的所述終端的設備資訊。 In an optional embodiment of the present invention, the webpage file sending apparatus 210 further includes: a generating unit, which generates a mapping relationship between the user agent information and the device information in advance; then, the determining unit 213 is based on the pre-generated user agent information. And mapping the device information to the device information of the terminal that is mapped to the user agent information. In another embodiment, the webpage file sending device 210 further includes: a generating unit, pre-generating device information and a mapping relationship of feature information; wherein the feature information is included in the user agent information; The determining unit 213 includes: an information extracting unit and an information query unit; the information extracting unit extracts feature information included in the user agent information; and the information query unit is based on pre-generated device information and feature information. Mapping the relationship, determining device information of the terminal corresponding to the feature information.

繼續參照圖4所示,本發明實施例中,一種網頁渲染裝置110包括:發送單元111,接收單元113和渲染單元115;所述發送單元111向伺服器200的接收單元211發送攜帶與終端對應的使用者代理資訊的網頁請求;所述接收單元113接收所述伺服器返回的與所述終端100的設備資訊對應的網頁文件;所述設備資訊是所述伺服器200的確定單元213根據所述使用者代理資訊確定的;所述渲染單元115利用與所述設備資訊對應的網頁文件進行網頁的渲染。 With reference to FIG. 4, in the embodiment of the present invention, a webpage rendering apparatus 110 includes: a sending unit 111, a receiving unit 113, and a rendering unit 115. The sending unit 111 sends a carrying to the receiving unit 211 of the server 200 to carry the corresponding terminal. a webpage request of the user agent information; the receiving unit 113 receives a webpage file corresponding to the device information of the terminal 100 returned by the server; the device information is determined by the determining unit 213 of the server 200. The user agent information is determined; the rendering unit 115 performs rendering of the webpage by using a webpage file corresponding to the device information.

本發明可選的實施例中,上述網頁渲染裝置110還包括:文件接收單元,接收所述伺服器返回的文件;所述文件包含與終端的設備資訊對應的網頁文件的文件標識;請求發送單元,向所述伺服器發送攜帶所述文件標識的獲取請求;所述接收單元113接收所述伺服器回應於所述獲取請求返回的與所述終端的設備資訊對應的網頁文件。 In an optional embodiment of the present invention, the webpage rendering apparatus 110 further includes: a file receiving unit that receives a file returned by the server; the file includes a file identifier of a webpage file corresponding to device information of the terminal; and a request sending unit And sending, by the server, an acquisition request that carries the file identifier; the receiving unit 113 receives a webpage file corresponding to the device information of the terminal that is returned by the server in response to the obtaining request.

利用上述網頁渲染裝置,本發明實施例可以至少達到如下技術效果: With the above webpage rendering device, the embodiment of the present invention can achieve at least the following technical effects:

相較於現有技術,由於伺服器在向終端返回網頁渲染過程所需的網頁文件之前,需要確定終端的設備資訊,並獲取與該設備資訊對應的網頁文件,從而使得最終伺服器向終端返回的是網頁渲染過程所需的網頁文件,而避免將其他不需被載入的網頁文件返回至上述終端,在一定程度上,可以降低對網路資源的消耗。另外,藉由本發明實施例提供的上述方法,在網頁渲染之前,確定終端的設備資訊並確定與設備資訊對應的網頁文件均是由伺服器來執行的,避免了由終端執行上述過程,從而避免因終端執行上述步驟而過多消耗終端的處理資源的問題,進而提升終端渲染網頁的性能,提升網頁回應的速度。 Compared with the prior art, before the server returns the webpage file required by the webpage rendering process to the terminal, the device information of the terminal needs to be determined, and the webpage file corresponding to the device information is obtained, so that the final server returns to the terminal. It is a webpage file required by the webpage rendering process, and avoids returning other webpage files that do not need to be loaded to the above terminal, and to a certain extent, can reduce the consumption of network resources. In addition, by the foregoing method provided by the embodiment of the present invention, before the webpage is rendered, determining device information of the terminal and determining that the webpage file corresponding to the device information is executed by the server, thereby avoiding performing the foregoing process by the terminal, thereby avoiding Because the terminal performs the above steps, the problem of processing resources of the terminal is excessively consumed, thereby improving the performance of the terminal rendering the webpage and improving the response speed of the webpage.

繼續參照圖4,本發明實施例中,一種網頁渲染系統,包括:伺服器200、第一資料庫300和第二資料庫400,所述第一資料庫300儲存有使用者代理資訊與設備資訊的映射關係,所述第二資料庫400儲存有與設備資訊對應的網頁文件,所述伺服器200接收終端100發送的攜帶使用者代理資訊的網頁請求,並從所述第一資料庫300中查詢與所述網頁請求中攜帶的使用者代理資訊對應的設備資訊,所述伺服器200從所述第二資料庫400獲取與所述設備資訊對應的網頁文件,並將獲取的所述網頁文件發送至終端100。 With reference to FIG. 4, in a embodiment of the present invention, a webpage rendering system includes: a server 200, a first database 300, and a second database 400. The first database 300 stores user agent information and device information. The second database 400 stores a webpage file corresponding to the device information, and the server 200 receives the webpage request that is sent by the terminal 100 and carries the user agent information, and is from the first database 300. Querying device information corresponding to the user agent information carried in the webpage request, the server 200 acquires a webpage file corresponding to the device information from the second database 400, and obtains the obtained webpage file Send to terminal 100.

其中,本發明可選的實施例中,上述系統還可以包括:Web API(Application Programming Interface,應用程式設計發展介面)和TFS(Team Foundation Server, 分散式文件系統)介面,所述Web API和TFS介面都是基於上述伺服器200和第一資料庫300的用以向上層業務提供服務的兩個介面,上述Web API和上述TFS介面可以用以將從第二資料庫400返回的不同的結果(如HTML、圖片等)包裝成相應的API(如Ajax),以便於各種上層業務去呼叫上述API,從而便於業務的實現,增強使用者體驗。 In an optional embodiment of the present invention, the foregoing system may further include: a Web API (Application Programming Interface) and a TFS (Team Foundation Server, The Decentralized File System interface, the Web API and the TFS interface are both based on the two interfaces of the server 200 and the first database 300 for providing services to the upper layer service, and the Web API and the TFS interface can be used. The different results (such as HTML, pictures, etc.) returned from the second database 400 are packaged into corresponding APIs (such as Ajax), so that various upper-layer services can call the above APIs, thereby facilitating the implementation of the service and enhancing the user experience.

為了描述的方便,描述以上裝置時以功能分為各種單元分別描述。當然,在實施本發明時可以把各單元的功能在同一個或多個軟體和/或硬體中實現。 For the convenience of description, the above devices are described separately by function into various units. Of course, the functions of the various units may be implemented in the same or multiple software and/or hardware in the practice of the invention.

本領域內的技術人員應明白,本發明的實施例可提供為方法、系統、或電腦程式產品。因此,本發明可採用完全硬體實施例、完全軟體實施例、或結合軟體和硬體方面的實施例的形式。而且,本發明可採用在一個或多個其中包含有電腦可用程式碼的電腦可用儲存媒體(包括但不限於磁碟記憶體、CD-ROM、光學記憶體等)上實施的電腦程式產品的形式。 Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Thus, the present invention can take the form of a fully hardware embodiment, a fully software embodiment, or an embodiment combining soft and hardware aspects. Moreover, the present invention may take the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer usable code. .

本發明是參照根據本發明實施例的方法、設備(系統)、和電腦程式產品的流程圖和/或方塊圖來描述的。應理解可由電腦程式指令實現流程圖和/或方塊圖中的每一流程和/或方塊、以及流程圖和/或方塊圖中的流程和/或方塊的結合。可提供這些電腦程式指令到通用電腦、專用電腦、嵌入式處理機或其他可程式設計資料處理設備的處理器以產生一個機器,使得藉由電腦或其他可程式設 計資料處理設備的處理器執行的指令產生用於實現在流程圖一個流程或多個流程和/或方塊圖一個方塊或多個方塊中指定的功能的裝置。 The present invention has been described with reference to flowchart illustrations and/or block diagrams of a method, apparatus (system), and computer program product according to embodiments of the invention. It will be understood that each flow and/or block of the flowcharts and/or <RTIgt; These computer program instructions can be provided to a processor of a general purpose computer, a special purpose computer, an embedded processor or other programmable data processing device to produce a machine for use by a computer or other programmable The instructions executed by the processor of the data processing device generate means for implementing the functions specified in one or more of the flow or blocks and/or blocks of the block diagram.

這些電腦程式指令也可儲存在能引導電腦或其他可程式設計資料處理設備以特定方式工作的電腦可讀記憶體中,使得儲存在該電腦可讀記憶體中的指令產生包括指令裝置的製造品,該指令裝置實現在流程圖一個流程或多個流程和/或方塊圖一個方塊或多個方塊中指定的功能。 The computer program instructions can also be stored in a computer readable memory that can boot a computer or other programmable data processing device to operate in a particular manner, such that instructions stored in the computer readable memory produce an article of manufacture including the instruction device. The instruction means implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.

這些電腦程式指令也可裝載到電腦或其他可程式設計資料處理設備上,使得在電腦或其他可程式設計設備上執行一系列操作步驟以產生電腦實現的處理,從而在電腦或其他可程式設計設備上執行的指令提供用於實現在流程圖一個流程或多個流程和/或方塊圖一個方塊或多個方塊中指定的功能的步驟。 These computer program instructions can also be loaded onto a computer or other programmable data processing device to perform a series of operational steps on a computer or other programmable device to produce computer-implemented processing on a computer or other programmable device. The instructions executed on the steps provide steps for implementing the functions specified in one or more flows of the flowchart or in a block or blocks of the flowchart.

還需要說明的是,用語“包括”、“包含”或者其任何其他變體意在涵蓋非排他性的包含,從而使得包括一系列要素的過程、方法、商品或者設備不僅包括那些要素,而且還包括沒有明確列出的其他要素,或者是還包括為這種過程、方法、商品或者設備所固有的要素。在沒有更多限制的情況下,由語句“包括一個......”限定的要素,並不排除在包括所述要素的過程、方法、商品或者設備中還存在另外的相同要素。 It is also to be understood that the phrase "comprise" or "comprises" or "includes" or any other variants is intended to encompass a non-exclusive inclusion, such that a process, method, article, Other elements not explicitly listed, or elements that are inherent to such a process, method, commodity, or equipment. An element defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device including the element.

本領域技術人員應明白,本發明的實施例可提供為方法、系統或電腦程式產品。因此,本發明可採用完全硬體 實施例、完全軟體實施例或結合軟體和硬體方面的實施例的形式。而且,本發明可採用在一個或多個其中包含有電腦可用程式碼的電腦可用儲存媒體(包括但不限於磁碟記憶體、CD-ROM、光學記憶體等)上實施的電腦程式產品的形式。 Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Therefore, the present invention can be completely hardware Embodiments, fully software embodiments or forms incorporating embodiments of the software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer usable code. .

本發明可以在由電腦執行的電腦可執行指令的一般上下文中描述,例如程式模組。一般地,程式模組包括執行特定任務或實現特定抽象資料類型的常式、程式、物件、元件、資料結構等等。也可以在分散式運算環境中實踐本發明,在這些分散式運算環境中,由藉由通訊網路而被連接的遠端處理設備來執行任務。在分散式運算環境中,程式模組可以位於包括存放裝置在內的本地和遠端電腦儲存媒體中。 The invention may be described in the general context of computer-executable instructions executed by a computer, such as a program module. Generally, a program module includes routines, programs, objects, components, data structures, and the like that perform particular tasks or implement particular abstract data types. The invention may also be practiced in a distributed computing environment in which tasks are performed by remote processing devices that are connected by means of a communication network. In a decentralized computing environment, the program modules can be located in local and remote computer storage media, including storage devices.

本說明書中的各個實施例均採用遞進的方式描述,各個實施例之間相同相似的部分互相參見即可,每個實施例重點說明的都是與其他實施例的不同之處。尤其,對於系統實施例而言,由於其基本相似於方法實施例,所以描述的比較簡單,相關之處參見方法實施例的部分說明即可。 The various embodiments in the specification are described in a progressive manner, and the same or similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.

以上所述僅為本發明的實施例而已,並不用於限制本發明。對於本領域技術人員來說,本發明可以有各種更改和變化。凡在本發明的精神和原理之內所作的任何修改、等同替換、改進等,均應包含在本發明的申請專利範圍之內。 The above description is only an embodiment of the present invention and is not intended to limit the present invention. It will be apparent to those skilled in the art that various modifications and changes can be made in the present invention. Any modifications, equivalents, improvements, etc. made within the spirit and scope of the invention are intended to be included within the scope of the invention.

Claims (12)

一種網頁文件發送方法,包括:伺服器接收終端發送的攜帶與所述終端對應的使用者代理資訊的網頁請求;所述伺服器根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊;所述伺服器獲取與所述設備資訊對應的網頁文件並向所述終端發送;其中,所述伺服器根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊之前,所述方法還包括:所述伺服器將使用者代理資訊和設備資訊的映射關係進行儲存;所述伺服器根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊,具體包括:所述伺服器根據預先產生的使用者代理資訊和設備資訊的映射關係,查找與所述使用者代理資訊相映射的所述終端的設備資訊;或,所述伺服器根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊之前,所述方法還包括:所述伺服器將設備資訊和特徵資訊的映射關係進行儲存;所述特徵資訊是所述使用者代理資訊中包含的; 所述伺服器根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊,具體包括:所述伺服器提取所述使用者代理資訊中包含的特徵資訊;所述伺服器根據儲存的設備資訊和特徵資訊的映射關係,查詢與所述特徵資訊對應的所述終端的設備資訊;其中,所述伺服器根據預先產生的使用者代理資訊和設備資訊的映射關係,查找與所述使用者代理資訊相映射的所述終端的設備資訊之後,所述方法還包括:若未查找到與所述使用者代理資訊相映射的所述終端的設備資訊,則所述伺服器向所述終端返回與所述網頁請求對應的基本資源包;所述伺服器接收所述終端返回的與該終端對應的設備資訊和使用者代理資訊,產生返回的設備資訊和使用者代理資訊的映射關係並儲存。 A method for sending a webpage file, comprising: a server receiving a webpage request sent by a terminal and carrying user agent information corresponding to the terminal; the server determining, according to the user agent information, determining, corresponding to the user agent information The device information of the terminal; the server obtains a webpage file corresponding to the device information and sends the webpage file to the terminal; wherein the server determines the user agent according to the user agent information Before the information corresponding to the device information of the terminal, the method further includes: the server storing a mapping relationship between the user agent information and the device information; the server determining, according to the user agent information, The device information of the terminal corresponding to the user agent information specifically includes: the server searching for the terminal mapped with the user agent information according to a mapping relationship between the user agent information and the device information generated in advance Device information; or, the server determines and the user generation according to the user agent information Before the information terminal apparatus corresponding to the information, the method further comprising: mapping relationship between the server apparatus information and the feature information is stored; wherein said user information is the information contained in the proxy; Determining, by the server, the device information of the terminal corresponding to the user agent information according to the user agent information, where the server includes: extracting, by the server, feature information included in the user agent information; The server queries the device information of the terminal corresponding to the feature information according to the mapping relationship between the stored device information and the feature information; wherein the server is mapped according to the pre-generated user agent information and device information. After the device information of the terminal that is mapped to the user agent information is searched, the method further includes: if the device information of the terminal that is mapped with the user agent information is not found, The server returns a basic resource package corresponding to the webpage request to the terminal; the server receives device information and user agent information corresponding to the terminal returned by the terminal, and generates returned device information and a user agent. Information mapping and storage. 根據申請專利範圍第1項所述的方法,其中,所述伺服器獲取與所述設備資訊對應的網頁文件並向所述終端發送之前,所述方法還包括:所述伺服器根據所述設備資訊,確定與所述設備資訊對應的網頁文件的文件標識;所述伺服器向所述終端發送包含所述文件標識的文件;所述伺服器獲取與所述設備資訊對應的網頁文件並向所述終端發送,具體包括: 所述伺服器接收所述終端發送的攜帶所述文件標識的文件獲取請求;所述伺服器回應於所述文件獲取請求,獲取與所述設備資訊對應的網頁文件並向所述終端發送。 The method of claim 1, wherein before the server obtains a webpage file corresponding to the device information and transmits the webpage file to the terminal, the method further comprises: the server according to the device Information, determining a file identifier of the webpage file corresponding to the device information; the server sending a file including the file identifier to the terminal; the server acquiring a webpage file corresponding to the device information and The terminal sends, specifically: The server receives a file acquisition request that is sent by the terminal and carries the file identifier; the server, in response to the file acquisition request, acquires a webpage file corresponding to the device information and sends the file to the terminal. 根據申請專利範圍第1或2項所述的方法,其中,所述設備資訊包括顯示器資訊。 The method of claim 1 or 2, wherein the device information comprises display information. 根據申請專利範圍第3項所述的方法,其中,所述顯示器資訊包括解析度資訊或像素密度資訊或螢幕尺寸資訊。 The method of claim 3, wherein the display information comprises resolution information or pixel density information or screen size information. 一種網頁渲染方法,包括:終端向伺服器發送攜帶與所述終端對應的使用者代理資訊的網頁請求;所述終端接收所述伺服器返回的與所述終端的設備資訊對應的網頁文件;所述終端接收的網頁文件是由所述伺服器根據所述設備資訊獲取到的,所述設備資訊是所述伺服器根據所述使用者代理資訊確定的;所述終端利用與所述設備資訊對應的網頁文件進行網頁的渲染;其中,若所述伺服器未確定到與所述使用者代理資訊對應的所述終端的設備資訊,則所述終端接收所述伺服器返回與所述網頁請求對應的基本資源包;所述終端利用所述基本資源包進行網頁載入,並採集與所述終端對應的設備資訊和使用者代理資訊;所述終端向所述伺服器發送所述設備資訊和與所述設 備資訊對應的所述使用者代理資訊。 A webpage rendering method includes: the terminal sends a webpage request carrying the user agent information corresponding to the terminal to the server; the terminal receives the webpage file corresponding to the device information of the terminal returned by the server; The webpage file received by the terminal is obtained by the server according to the device information, where the device information is determined by the server according to the user agent information; and the terminal uses the device information corresponding to the device The webpage file performs rendering of the webpage; wherein, if the server does not determine the device information of the terminal corresponding to the user agent information, the terminal receives the server return corresponding to the webpage request The basic resource package; the terminal uses the basic resource package to perform webpage loading, and collects device information and user agent information corresponding to the terminal; the terminal sends the device information and the server to the server Said The user agent information corresponding to the backup information. 根據申請專利範圍第5項所述的方法,其中,所述終端接收所述伺服器返回的與所述終端的設備資訊對應的網頁文件之前,所述方法還包括:所述終端接收所述伺服器返回的文件;所述文件包含與所述終端的設備資訊對應的網頁文件的文件標識;所述終端向所述伺服器發送攜帶所述文件標識的獲取請求;所述終端接收所述伺服器返回的與所述終端的設備資訊對應的網頁文件,具體包括:所述終端接收所述伺服器回應於所述獲取請求返回的與所述終端的設備資訊對應的網頁文件。 The method of claim 5, wherein before the terminal receives the webpage file corresponding to the device information of the terminal returned by the server, the method further includes: the terminal receiving the servo a file returned by the device; the file includes a file identifier of a webpage file corresponding to the device information of the terminal; the terminal sends an acquisition request carrying the file identifier to the server; the terminal receives the server The returned webpage file corresponding to the device information of the terminal specifically includes: the terminal receiving a webpage file corresponding to the device information of the terminal returned by the server in response to the obtaining request. 根據申請專利範圍第5或6項所述的方法,其中,所述設備資訊包括顯示器資訊。 The method of claim 5, wherein the device information comprises display information. 一種網頁文件發送裝置,包括:接收單元,確定單元,獲取單元及發送單元;所述接收單元接收終端發送的攜帶與所述終端對應的使用者代理資訊的網頁請求;所述確定單元根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊;所述獲取單元獲取與所述設備資訊對應的網頁文件;所述發送單元向所述終端發送與所述設備資訊對應的網頁文件;其中,若所述確定單元未確定到與所述使用者代理資訊對應的所述終端的設備資訊,則所述發送單元向所述終端返回與所述網頁請求對應的基本資源包; 所述接收單元接收所述終端返回的與該終端對應的設備資訊和使用者代理資訊,產生返回的使用者代理資訊和設備資訊的映射關係。 A webpage file transmitting apparatus, comprising: a receiving unit, a determining unit, an obtaining unit, and a sending unit; the receiving unit receiving a webpage request sent by the terminal and carrying user agent information corresponding to the terminal; the determining unit according to the User agent information, determining device information of the terminal corresponding to the user agent information; the obtaining unit acquiring a webpage file corresponding to the device information; the sending unit sending the device to the terminal a webpage file corresponding to the information; wherein, if the determining unit does not determine device information of the terminal corresponding to the user agent information, the sending unit returns a basic corresponding to the webpage request to the terminal Resource package The receiving unit receives the device information and the user agent information corresponding to the terminal returned by the terminal, and generates a mapping relationship between the returned user agent information and the device information. 根據申請專利範圍第8項所述的裝置,其中,所述裝置還包括:儲存單元,將所述使用者代理資訊和設備資訊的映射關係進行儲存;則所述確定單元根據儲存的使用者代理資訊和設備資訊的映射關係,查找與所述使用者代理資訊相映射的所述終端的設備資訊;或,所述裝置還包括:儲存單元,將設備資訊和特徵資訊的映射關係進行儲存;所述特徵資訊是所述使用者代理資訊中包含的;則所述確定單元包括:資訊提取單元和資訊查詢單元;所述資訊提取單元提取所述使用者代理資訊中包含的特徵資訊;所述資訊查詢單元根據儲存的設備資訊和特徵資訊的映射關係,查詢與所述特徵資訊對應的所述終端的設備資訊。 The device of claim 8, wherein the device further comprises: a storage unit that stores the mapping relationship between the user agent information and the device information; and the determining unit is based on the stored user agent a mapping relationship between the information and the device information, and searching for the device information of the terminal that is mapped to the user agent information; or the device further includes: a storage unit, storing the mapping relationship between the device information and the feature information; The feature information is included in the user agent information; the determining unit includes: an information extracting unit and a information query unit; the information extracting unit extracts feature information included in the user agent information; the information The query unit queries the device information of the terminal corresponding to the feature information according to the mapping relationship between the stored device information and the feature information. 一種網頁渲染裝置,包括:發送單元,接收單元和渲染單元;所述發送單元向伺服器發送攜帶與終端對應的使用者代理資訊的網頁請求;所述接收單元接收所述伺 服器返回的與所述終端的設備資訊對應的網頁文件;所述接收單元接收的網頁文件是由所述伺服器根據所述設備資訊獲取到的,所述設備資訊是所述伺服器根據所述使用者代理資訊確定的;所述渲染單元利用與所述設備資訊對應的網頁文件進行網頁的渲染;其中,若所述伺服器未確定到與所述使用者代理資訊對應的所述終端的設備資訊,則所述接收單元接收所述伺服器返回與所述網頁請求對應的基本資源包;所述渲染單元利用所述基本資源包進行網頁載入,並採集與所述終端對應的設備資訊和使用者代理資訊;所述發送單元向所述伺服器發送所述設備資訊和與所述設備資訊對應的所述使用者代理資訊。 A webpage rendering apparatus includes: a sending unit, a receiving unit, and a rendering unit; the sending unit sends a webpage request carrying a user agent information corresponding to the terminal to the server; the receiving unit receives the server a webpage file corresponding to the device information of the terminal returned by the server; the webpage file received by the receiving unit is obtained by the server according to the device information, and the device information is the server according to the Determining, by the user agent information, the rendering unit performs rendering of the webpage by using a webpage file corresponding to the device information; wherein, if the server does not determine the terminal corresponding to the user agent information Receiving, by the receiving unit, the server returns a basic resource package corresponding to the webpage request; the rendering unit uses the basic resource package to perform webpage loading, and collects device information corresponding to the terminal. And the user agent information; the sending unit sends the device information and the user agent information corresponding to the device information to the server. 根據申請專利範圍第10項所述的裝置,其中,所述裝置還包括:文件接收單元,接收所述伺服器返回的文件;所述文件包含與終端的設備資訊對應的網頁文件的文件標識;請求發送單元,向所述伺服器發送攜帶所述文件標識的獲取請求;所述接收單元接收所述伺服器回應於所述獲取請求返回的與所述終端的設備資訊對應的網頁文件。 The device of claim 10, wherein the device further comprises: a file receiving unit that receives a file returned by the server; the file includes a file identifier of a webpage file corresponding to device information of the terminal; And a request sending unit that sends an acquisition request that carries the file identifier to the server; the receiving unit receives a webpage file corresponding to the device information of the terminal that is returned by the server in response to the obtaining request. 一種網頁渲染系統,包括伺服器、第一資料庫和第二資料庫,所述第一資料庫儲存有使用者代理資訊與設備資訊的映射關係,所述第二資料庫儲存有與設備資訊對應的網頁文件,所述伺服器接收終端發送的攜帶使用者代 理資訊的網頁請求,並從所述第一資料庫中查詢與所述網頁請求中攜帶的使用者代理資訊對應的設備資訊,所述伺服器從所述第二資料庫獲取與所述設備資訊對應的網頁文件,並將獲取的所述網頁文件發送至所述終端;其中,若所述伺服器未查詢到與所述使用者代理資訊對應的所述設備資訊,則所述伺服器向所述終端返回與所述網頁請求對應的基本資源包;所述伺服器接收所述終端返回的與該終端對應的設備資訊和使用者代理資訊,產生返回的設備資訊和使用者代理資訊的映射關係並儲存。 A webpage rendering system includes a server, a first database, and a second database, wherein the first database stores a mapping relationship between user agent information and device information, and the second database stores information corresponding to device information. Web page file, the server receiving terminal sends a user generation Receiving a webpage request of the information, and querying, from the first database, device information corresponding to the user agent information carried in the webpage request, the server acquiring the device information from the second database Corresponding webpage file, and sending the obtained webpage file to the terminal; wherein, if the server does not query the device information corresponding to the user agent information, the server The terminal returns a basic resource package corresponding to the webpage request; the server receives the device information and the user agent information corresponding to the terminal returned by the terminal, and generates a mapping relationship between the returned device information and the user agent information. And save.
TW106112411A 2016-06-28 2017-04-13 Web file sending method, webpage rendering method and device, webpage rendering system TWI670611B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610488238.2A CN106897336A (en) 2016-06-28 2016-06-28 Web page files sending method, webpage rendering intent and device, webpage rendering system
??201610488238.2 2016-06-28

Publications (2)

Publication Number Publication Date
TW201800962A TW201800962A (en) 2018-01-01
TWI670611B true TWI670611B (en) 2019-09-01

Family

ID=59190561

Family Applications (1)

Application Number Title Priority Date Filing Date
TW106112411A TWI670611B (en) 2016-06-28 2017-04-13 Web file sending method, webpage rendering method and device, webpage rendering system

Country Status (3)

Country Link
CN (1) CN106897336A (en)
TW (1) TWI670611B (en)
WO (1) WO2018001124A1 (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107577596A (en) * 2017-08-09 2018-01-12 福建天泉教育科技有限公司 Automatic interface testing method, the storage medium of adaptive language and browser
CN109587544A (en) * 2018-09-27 2019-04-05 杭州家娱互动网络科技有限公司 A kind of icon rendering method, device and electronic equipment
CN109474680B (en) * 2018-11-02 2019-11-12 中国搜索信息科技股份有限公司 A kind of mobile device attribute detection method based on reverse proxy
CN109831493A (en) * 2019-01-18 2019-05-31 深圳壹账通智能科技有限公司 A kind of detection method of image configurations, device, equipment and medium
CN109933735B (en) * 2019-03-04 2021-08-20 三星电子(中国)研发中心 Scheduling method, webpage rendering method, webpage display method and equipment thereof
CN109889608B (en) * 2019-03-29 2021-12-10 北京金山安全软件有限公司 Dynamic resource loading method and device, electronic equipment and storage medium
CN110390065B (en) * 2019-07-31 2024-02-06 腾讯科技(深圳)有限公司 Webpage acquisition method, device and system
CN112632941A (en) * 2019-09-23 2021-04-09 北京国双科技有限公司 Method, device, equipment and storage medium for generating PDF format public security document
CN112883298B (en) * 2019-11-29 2024-03-01 阿里巴巴集团控股有限公司 Information processing method, device, electronic equipment and storage medium
CN111414562B (en) * 2020-02-26 2023-08-29 深圳运动帝图科技有限公司 Application program page API interface preposition method, device and storage medium
CN113467776B (en) * 2021-06-28 2023-06-13 青岛海尔科技有限公司 Method and device for accessing equipment, storage medium and electronic device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101067819A (en) * 2007-06-07 2007-11-07 北京大学 Web page resource issuing method and issuing system
CN1996989B (en) * 2006-01-01 2010-06-23 腾讯科技(深圳)有限公司 A personal page system and its realization method
CN104462131A (en) * 2013-09-23 2015-03-25 阿里巴巴集团控股有限公司 Method and device for processing information issuing page

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101150803B (en) * 2007-10-24 2011-08-24 优视科技有限公司 Method for micro-browser to process network data, micro-browser and its server
US9064029B2 (en) * 2010-06-07 2015-06-23 Quora, Inc. Dynamically identifying and evaluating component hierarchy for rendering content components on a webpage
CN103399911A (en) * 2013-07-30 2013-11-20 北京小米科技有限责任公司 Access processing method, device and terminal device on basis of browser client
CN104462231B (en) * 2014-11-11 2018-12-04 北京奇安信科技有限公司 The method, apparatus and system of webpage rendering

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1996989B (en) * 2006-01-01 2010-06-23 腾讯科技(深圳)有限公司 A personal page system and its realization method
CN101067819A (en) * 2007-06-07 2007-11-07 北京大学 Web page resource issuing method and issuing system
CN104462131A (en) * 2013-09-23 2015-03-25 阿里巴巴集团控股有限公司 Method and device for processing information issuing page

Also Published As

Publication number Publication date
TW201800962A (en) 2018-01-01
WO2018001124A1 (en) 2018-01-04
CN106897336A (en) 2017-06-27

Similar Documents

Publication Publication Date Title
TWI670611B (en) Web file sending method, webpage rendering method and device, webpage rendering system
WO2017113060A1 (en) Website access method and device, and website system
US8527862B2 (en) Methods for making ajax web applications bookmarkable and crawlable and devices thereof
US9547721B2 (en) Native application search results
US10346501B2 (en) Mobile enablement of existing web sites
CN106687949B (en) Search results for native applications
WO2015161658A1 (en) Webpage resource loading method and device
US8707162B1 (en) Methods and systems for reducing web page transmission bandwidth
CN110221871B (en) Webpage acquisition method and device, computer equipment and storage medium
WO2015074459A1 (en) Method and apparatus for opening webpage, invoking client, and creating light app
JP6140904B2 (en) Terminal marking method, terminal marking device, program, and recording medium
WO2016050124A1 (en) Method, device and server for web page transcoding
WO2017143747A1 (en) Network request method and system for network terminal
TWI519980B (en) Method and device for displaying web page and computer-readable storage medium
US20140245124A1 (en) System and method thereof for browser agnostic extension models
CN109670100B (en) Page data capturing method and device
US20150312313A1 (en) Proxy for modifying http messages to comply with browser
US10165036B1 (en) Network resource remote process execution
JP5604016B1 (en) Script caching method and information processing apparatus using the same
US10095791B2 (en) Information search method and apparatus
WO2015058614A1 (en) Bookmark storage method and device, and method and device for determining bookmark to be browsed
CN113452733A (en) File downloading method and device
CN105808727A (en) Website cross-screen adaptation technology architecture and adaptation method based on HTML5 (Hypertext Markup Language 5)
US20130110912A1 (en) System and method for providing anonymous internet browsing
US8332469B1 (en) Web resource caching