TW201800962A - Webpage file sending method, webpage rendering method and device and webpage rendering system - Google Patents

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

Info

Publication number
TW201800962A
TW201800962A TW106112411A TW106112411A TW201800962A TW 201800962 A TW201800962 A TW 201800962A TW 106112411 A TW106112411 A TW 106112411A TW 106112411 A TW106112411 A TW 106112411A TW 201800962 A TW201800962 A TW 201800962A
Authority
TW
Taiwan
Prior art keywords
information
terminal
webpage
server
user agent
Prior art date
Application number
TW106112411A
Other languages
Chinese (zh)
Other versions
TWI670611B (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

Landscapes

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

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 comprises the steps that a server receives a webpage request which is sent by a terminal and carries user agent information corresponding to the terminal; the server determines equipment information, corresponding to the user agent information, of the terminal according to the user agent information; and the server acquires webpage files corresponding to the equipment information and sends the webpage files to the terminal. Before webpage rendering, the equipment information of the terminal is determined, and it is determined that the webpage files corresponding to the equipment information are all executed by the server, so that the problem of excessively consuming processing resources of the terminal when the terminal executes the steps is avoided, and then the webpage rendering performance of the terminal is improved.

Description

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

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

現如今,藉由瀏覽器或應用APP的使用者端存取各種網頁已成為人們獲取資訊的管線之一。目前,人們所使用的各種終端往往具備不同的設備資訊(如:終端螢幕的大小),而針對終端所具備的設備資訊的不同,可在終端上展示不同的網頁樣式。例如,新浪網(http://www.sina.com.cn/)在手機和電腦上是以不同的網頁樣式進行展示的。 Nowadays, accessing various webpages through the user end of the 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 screen of the terminal), and according to the different device information provided by the terminal, different web page styles can be displayed on the terminal. For example, Sina.com (https://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 can render different web page styles by obtaining different web page files from the server. The web page files may include: CSS (Cascading Style Sheets) files, pictures, and the like. In the prior art, in the process of requesting a webpage through a browser or a user terminal, a terminal first sends a webpage request to a server, and then, the server responds to the webpage request and returns to the terminal during the webpage loading process. Web files that may be used. The terminal received the webpage file returned by the server After that, it needs to detect its own device information and use a media query method to determine a webpage style that is compatible with the device information and a webpage file that needs to be loaded to render the webpage style. In the end, the terminal may select a web page file (such as a CCS file, picture, etc.) to be loaded from the web page files returned by the server and use these web page files to render a web page.

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

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

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

為解決上述技術問題,本發明實施例提供的網頁文件發送方法、網頁渲染方法及裝置、網頁渲染系統是這樣實現的:一種網頁文件發送方法,包括:伺服器接收終端發送的攜帶與所述終端對應的使用者代理資訊的網頁請求; 所述伺服器根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊;所述伺服器獲取與所述設備資訊對應的網頁文件並向所述終端發送。 In order to solve the above technical problems, the webpage file sending method, webpage rendering method and device, and webpage rendering system provided by the embodiments of the present invention are implemented as follows: A webpage file sending method includes: a server receiving a terminal sent by a terminal and the terminal Web request for 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 obtains a webpage file corresponding to the device information and sends it to the terminal.

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

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

一種網頁渲染裝置,包括:發送單元,接收單元和渲染單元;所述發送單元向伺服器發送攜帶與終端對應的使用者代理資訊的網頁請求;所述接收單元接收所述伺服器返回的與所述終端的設備資訊對應的網頁文件;所述設備資訊是所述伺服器根據所述使用者代理資訊確定的;所述 渲染單元利用與所述設備資訊對應的網頁文件進行網頁的渲染。 A webpage rendering device includes: a sending unit, a receiving unit, and a rendering unit; the sending unit sends a webpage request that carries user agent information corresponding to a terminal to a server; and the receiving unit receives The 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 The rendering unit uses a webpage file corresponding to the device information to render a webpage.

一種網頁渲染系統,包括伺服器、第一資料庫和第二資料庫,所述第一資料庫儲存有使用者代理資訊與設備資訊的映射關係,所述第二資料庫儲存有與設備資訊對應的網頁文件,所述伺服器接收終端發送的攜帶使用者代理資訊的網頁請求,並從所述第一資料庫中查詢與所述網頁請求中攜帶的使用者代理資訊對應的設備資訊,所述伺服器從所述第二資料庫獲取與所述設備資訊對應的網頁文件,並將獲取的所述網頁文件發送至終端。 A webpage rendering system includes a server, a first database, and a second database. The first database stores a mapping relationship between user agent information and device information, and the second database stores a correspondence with device information. The webpage file, the server receives the webpage request carrying the user agent information sent by the terminal, and queries from the first database the device information corresponding to the user agent information carried in the webpage request, the 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 at least one technical solution adopted in the embodiment of the present invention can achieve the following beneficial effects:

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

S101‧‧‧步驟 S101‧‧‧step

S102‧‧‧步驟 S102‧‧‧step

S103‧‧‧步驟 S103‧‧‧step

S103‧‧‧步驟 S103‧‧‧step

10‧‧‧終端 10‧‧‧Terminal

20‧‧‧終端 20‧‧‧Terminal

S201‧‧‧步驟 S201‧‧‧step

S202‧‧‧步驟 S202‧‧‧step

S203‧‧‧步驟 S203‧‧‧step

S204‧‧‧步驟 S204‧‧‧step

S205‧‧‧步驟 S205‧‧‧step

S206‧‧‧步驟 S206‧‧‧step

S207‧‧‧步驟 S207‧‧‧step

100‧‧‧終端 100‧‧‧Terminal

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

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

111‧‧‧發送單元 111‧‧‧ sending unit

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

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

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

210‧‧‧網頁文件發送裝置 210‧‧‧ Web File Sending Device

211‧‧‧接收單元 211‧‧‧Receiving unit

213‧‧‧確定單元 213‧‧‧ Confirmation unit

215‧‧‧獲取單元 215‧‧‧Get Unit

217‧‧‧發送單元 217‧‧‧ sending unit

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

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

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

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

為了使本技術領域的人員更好地理解本發明中的技術方案,下面將結合本發明實施例中的附圖,對本發明實施例中的技術方案進行清楚、完整地描述,顯然,所描述的實施例僅僅是本發明一部分實施例,而不是全部的實施例。基於本發明中的實施例,本領域普通技術人員在沒有作出進步性勞動前提下所獲得的所有其他實施例,都應當屬於本發明保護的範圍。 In order to enable those skilled in the art to 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 with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described The embodiments are only a part of the embodiments of the present invention, but not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making progressive labor should fall within the protection scope of the present invention.

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

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

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

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

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

以下是一個網頁請求的例子: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: en-us 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 webpage request is "Method URL Protocol / Version": GET / sample.jsp HTTP / 1.1; Request Header information is: Accept: image / gif.image / jpeg. * / * Accept-Language: en-US Connection: Keep-Alive Host: localhost User-Agent: Mozila / 4.0 (compatible: MSIE5.01: Windows NT5.0) Accept-Encoding: gzip, deflate

請求頭資訊和請求正文之間一般可以空一行,表示請求頭資訊已經結束,接下來的是請求正文。在上述例子中,請求正文可以包含使用者提交的查詢字串資訊:username=jinqiao&password=1234。在以上例子中,請求正文只有一行內容。當然,在實際應用中,請求正文可以包含更多的內容。 There is usually a blank line between the request header and the request body, indicating that the request header information has ended, and the next is the request body. In the above example, the request body can 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. The user-agent information refers to identification information unique to a browser or a user terminal of the terminal, and includes: a hardware platform and a system. Software, applications, 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 webpage request, for the terminal with different device information, the webpage style to be rendered is not the same, that is, the webpage style finally rendered on the terminal's browser or user terminal needs to be based on the terminal. Device information to determine. In the embodiment of the present invention, after receiving the webpage request, the server is required to determine device information corresponding to a terminal that sends the webpage request. About the device information, including but not limited to: display information of the terminal, other hardware information of the terminal, operation of the terminal Industry system information, etc. The display information may include screen resolution information, pixel density information, or screen size. In short, according to the device information of the terminal, a webpage style that is 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 webpage styles on different terminals. In FIG. 2, the terminals 10 and 20 have different device information, for example, the resolutions of the screens are different. It is assumed that a certain webpage includes webpage modules A, B, and C, and the webpage module may be, for example, an image, a text, a button, or the like. It can be seen that when the terminals 10 and 20 request the webpage, the rendered webpage styles can be different, and different webpage styles can be reflected in the size of the text, the position and layout of the webpage module, and so on.

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

伺服器預先產生使用者代理資訊和設備資訊的映射關係,產生的映射關係可以儲存於Web伺服器的資料庫中。 The server generates a mapping relationship between user agent information and device information in advance, 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 is: 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 "mapped device information: 1920px * 1080px; etc.

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

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

值得一提的是,本發明其他實施例中,在上述步驟S102之前,所述方法還可以包括如下步驟: It is worth mentioning that, in other embodiments of the present invention, before the above 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 characteristic information, wherein the characteristic information is included in the user agent information. The above characteristic information may be any of the following: equipment brand model information, equipment operating system information, and the like. For example, a piece of 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, then the device brand model information is: "GT-I9100", the operating system information of the device The message is: "Android 4.1.1". It should be noted that the mapping relationship between the device information and the feature information may be generated in advance by the server. Alternatively, it is gradually generated by the server through a self-learning process. Alternatively, the mapping relationship between the device information and the feature information (that is, not necessarily generated by the server) is configured by an administrator.

相應地,以上步驟S102可以具體包括如下步驟: Accordingly, 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 feature information included in the user agent information; the server determines device information of the terminal corresponding to the feature information according to a mapping relationship between the previously generated device information and the feature information. In addition, the server can obtain the 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 "GT-I9100" by extracting the device brand and model information carried in the user agent information: "GT-I9100" (for example, the screen pixel information is: 480px * 800px, screen size information: 4.3 inches); for another example, the server extracts the operating system information carried in the user agent information: "Android 4.1.1" to determine the corresponding to "Android 4.1.1" A possible range of device information (such as: the screen size is: 3.0 ~ 5.3 inches, the pixel information of the screen is: (480px ~ 800px) * (800px ~ 1280px)).

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

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

本發明實施例中,在上述步驟S103之前,所述方法還包括如下步驟: In the embodiment of the present invention, before 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 a file identifier of a web page file corresponding to the device information according to the device information, wherein the file identifier may be, for example, a URL (Uniform Resource Locator) of a web page file or File name, the URL for example: * Picture: "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 resolution width (ie, device information) of the terminal screen is 400px, determine that the file name (ie, file identifier) of the CSS file (one of the webpage files) corresponding to the device information is: "400.css" ; When the width of the resolution of the terminal screen (ie, the device information) is 800px, it is determined that the file name (ie, the file identifier) of the CSS file corresponding to the device information is: "800.css".

b)所述伺服器向所述終端發送包含所述文件標識的 文件(即HTML文件)。 b) the server sends to the terminal a 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 a web page request from a terminal, a server (web server or application server) needs to return a corresponding HTTP response (HTTP Response) to the terminal in response to the web page request (HTTP request) sent by the terminal. The HTTP response (that is, the above-mentioned HTML document) may include: protocol status version code description information, response header (Response Header) information, and a response body. The returned HTML response may include the file identifiers determined above, such as the URL or file name of the CSS file of the required application, the URL of the picture of the required application, and so on. The HTML file may only include a file identifier of a web page file that the browser or user terminal needs to use in a subsequent web page rendering process. Following the above example, if the screen resolution of the current terminal is 400px * 800px, the CSS file required for 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 screen resolution of the current terminal is 800px * 1280px, the CSS file used in the rendering process should be "800.css", and the HTML file returned by the server should contain: <link href = "800. css "/>. In other words, the server may return to the terminal an HTML file containing the file identifiers of different webpage files according to the determined device information. The returned HTML files generally do not include the rest of the webpage files that do not need to be loaded. File identification. Following the above example, in the prior art, no matter the screen 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 screenshots For a terminal with a resolution of "400px * 800px", the above-mentioned CSS file: "800.css" is a webpage file that does not need to be loaded (that is, a webpage file that does not need to be used during the rendering of the webpage). Compared with the prior art, the embodiments of the present invention can return a webpage file corresponding to the device information to the terminal according to different screen resolutions (device information) of the terminal.

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

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

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

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

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

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

圖3為本發明一實施例提供的以伺服器為主體的網頁文件發送方法的流程圖。參照上述圖1所介紹的實施例,本發明一實施例中,若以伺服器的角度來實施本技術方案,該網頁文件發送方法包括如下步驟: FIG. 3 is a flowchart of a method for sending a webpage file using 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 a terminal and carrying 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 obtains a webpage file corresponding to the device information and sends it to the terminal.

以上步驟S201可以參照上述步驟S101的內容,以上步驟S202可以參照上述步驟S102的內容,以上步驟S204可以參照上述步驟S103的內容,本文不再予以贅述。 The above step S201 may refer to the content of the above step S101, the above step S202 may refer to the content of the above step S102, and the above step S204 may refer to the content of the above step S103, which will not be repeated here.

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

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

步驟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 need to be loaded for all possible rendering webpage styles. That is, after receiving the basic resource package, a terminal with any device information may use the basic resource package according to the basic resource package. Select a web file to load in a web style that matches your device information. After receiving the above-mentioned basic resource package, the terminal can collect its own device information (such as display information), and then dynamically determine the web page style that is suitable for its own device information, and the various loading requirements corresponding to the web page style. A webpage file, and a webpage file to be loaded is selected from the above-mentioned basic resource package, and finally the selected webpage file is used for rendering 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 a web page is loaded by using the basic resource package.

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

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

終端可向伺服器發送一攜帶上述設備資訊和使用者代理資訊的請求命令,以使得伺服器將採集到設備資訊和使用者代理資訊形成一定的映射關係,並儲存到資料庫中。藉由以上步驟S205~S207,可以在查詢不到與使用者代理 資訊對應的設備資訊時,藉由終端採集的方式,來對當前的資料庫(使用者代理資訊和設備資訊的對應關係)中的資料進行補充或完善,從而實現資料庫的“自學習過程”。藉由上述“自學習過程”,使得在伺服器後續查詢資料庫的過程中,就不會存在查找不到與使用者代理資訊對應的設備資訊的問題了,即總能查找到相匹配的結果,從而使得伺服器的執行效率能夠不斷提升。 The terminal may send a request command carrying the above-mentioned device information and user agent information to the server, so that the server forms a certain mapping relationship between the collected device information and user agent information, and stores it in the database. With the above steps S205 ~ S207, the user agent 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 means of terminal collection, thereby achieving the "self-learning process" of the database. . With the above-mentioned "self-learning process", during 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 , So that the execution efficiency of the server can be continuously improved.

上述圖3所介紹的實施例是從伺服器的角度說明了本發明的技術方案,實際上,本發明還可以從終端的角度進行實施,並同樣能夠解決上述問題。參照上述圖1所介紹的實施例,在本發明一實施例提供的一種網頁渲染方法,包括如下步驟: The embodiment described in FIG. 3 described 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 can also solve the above problems. Referring to the embodiment described in FIG. 1 above, a webpage rendering method provided by an embodiment of the present invention includes the following steps:

終端向伺服器發送攜帶與所述終端對應的使用者代理資訊的網頁請求。 The terminal sends a webpage request that carries 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 renders a webpage by using a webpage file corresponding to the device information.

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

另一方面,在現有技術中,由於終端(瀏覽器或使用者端)一般需要採集到自身的設備資訊,並利用媒體查詢(Media Query)方法,來確定與當前設備資訊所對應的網頁樣式及該網頁樣式所需載入的各種網頁文件,並從伺服器返回的網頁文件中,選取所需載入的各種網頁文件。可以看出,現有技術中除了存在增加了額外的、冗余的資源下載成本(即額外消耗網路資源),造成載入性能不佳的問題之外,還存在如下問題:終端在進行網頁渲染之前,需要確定自身的設備資訊,還需要利用媒體查詢方法判斷所需載入的網頁文件,並從伺服器返回的網頁文件中選取所需載入的網頁文件,一定程度上,終端執行上述步驟的過程均需要消耗自身的處理資源。也就是說,在網頁渲染的過程中,終端還需要考慮該以何種網頁樣式進行渲染,需要應用到哪些網頁條件,這勢必會影響到瀏覽器或使用者端渲染網頁的性能,降低網頁回應的速度。可見,藉由本發明實施例提供的上述方法,在網頁渲染之前,確定終端的設備資訊並確定與設備資訊對應的網頁文件均是 由伺服器來執行的,避免了由終端執行上述過程,從而避免因終端執行上述步驟而過多消耗終端的處理資源的問題,進而提升終端渲染網頁的性能,提升網頁回應的速度。 On the other hand, in the prior art, since a terminal (browser or user terminal) generally needs to collect its own device information and use a Media Query method to determine the web page style and Various webpage documents to be loaded in the webpage style, and from the webpage documents returned by the server, various webpage documents to be loaded are selected. It can be seen that, in the prior art, in addition to the problem of adding extra and redundant resource download costs (that is, extra consumption of network resources), resulting in poor loading performance, there are also the following problems: the terminal is rendering a web page 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 a certain extent, the terminal performs the above steps. The processes need to consume their own processing resources. In other words, in the process of web page rendering, the terminal also needs to consider which web page style to render and which web page conditions to apply. This will inevitably affect the performance of the web page rendered by the browser or user end, and reduce the web page 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, the device information of the terminal is determined and the webpage files corresponding to the device information are determined to be The execution by the server prevents the terminal from performing the above process, 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 the speed of the webpage response.

需要說明的是,以上各實施例所提供方法的各步驟的執行主體均可以是同一設備,或者,該方法也由不同設備作為執行主體。例如,步驟S201和步驟S202的執行主體可以為設備1,步驟S203的執行主體可以為設備2;又例如,步驟S201的執行主體可以為設備1,步驟S202和步驟S203的執行主體可以為設備2;等等。 It should be noted that, the execution subjects of the steps of the methods provided in the foregoing embodiments may be the same device, or the methods may also be executed by different devices. For example, the execution subject of steps S201 and S202 may be device 1 and the execution subject of step S203 may be device 2; for another example, the execution subject of step S201 may be device 1 and the execution subject of steps S202 and 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 device and a webpage file sending device 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 user terminal 101, a web page rendering device 110, and the server 200 includes a web page file sending device 210. The web page rendering device 110 and the web page described above The file sending device 210 may exist in the terminal 100 and the server 200 in software, or in a combination of hardware or software and hardware, respectively. The server 200 and the terminal 100 can communicate with each other through a network. The terminal 100 and the server 200 may include a display screen, a processing unit, a memory, a non-volatile memory, a bus, and an input / output device. In addition to the hardware, the terminal 100 and the server 200 also include corresponding software. It should be noted that the functions that can be implemented by each unit in the above-mentioned web page rendering device are similar to the functions that can be implemented by each step in the above-mentioned web page rendering method, so the specific details of the web page rendering device can refer to the above web page rendering The content of the method embodiment will not be described in detail herein again. Similarly, for specific details of the webpage file sending device, reference may be made to the content of the embodiment of the webpage file sending 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 device 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 sent by the sending unit 111 of the terminal 100 and carries the user agent information corresponding to the terminal 100; and the determining unit 213 determines a connection with the user based on the user agent information. Device information of the terminal corresponding to the proxy information; the obtaining unit 215 obtains a web file corresponding to the device information; and the sending unit 217 sends the web file corresponding to the device information to the terminal. The determining unit 213 can search the device information corresponding to the user agent information by searching the first database 300. The above first database 300 can store a 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 web files (resources), such as: HTML files, CSS files, pictures, JS files, and so on. The various web files stored in the second database 400 are mapped to 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.

利用上述網頁文件發送裝置,本發明實施例可以至少 達到如下技術效果: By using the above web file sending device, the embodiment of the present invention can at least Achieve the following technical effects:

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

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

繼續參照圖4所示,本發明實施例中,一種網頁渲染裝置110包括:發送單元111,接收單元113和渲染單元115;所述發送單元111向伺服器200的接收單元211發送攜帶與終端對應的使用者代理資訊的網頁請求;所述接收單元113接收所述伺服器返回的與所述終端100的設備資訊對應的網頁文件;所述設備資訊是所述伺服器200的確定單元213根據所述使用者代理資訊確定的;所述渲染單元115利用與所述設備資訊對應的網頁文件進行網頁的渲染。 Continuing to refer to FIG. 4, in the embodiment of the present invention, a webpage rendering device 110 includes: a sending unit 111, a receiving unit 113, and a rendering unit 115; the sending unit 111 sends to the receiving unit 211 of the server 200 to carry a corresponding terminal A request for a webpage of 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 according to the Determined by the user agent information; the rendering unit 115 uses a web page file corresponding to the device information to render a web page.

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

利用上述網頁渲染裝置,本發明實施例可以至少達到如下技術效果: With the above webpage rendering device, the embodiments 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 for the webpage rendering process to the terminal, the server needs to determine the device information of the terminal and obtain the webpage file corresponding to the device information, so that the final server returns the It is a webpage file required for the webpage rendering process, and avoids returning other webpage files that do not need to be loaded to the above terminal. To a certain extent, it can reduce the consumption of network resources. In addition, with the above method provided by the embodiment of the present invention, before the webpage is rendered, the device information of the terminal and the webpage file corresponding to the device information are determined to be executed by the server, which avoids the above process being performed by the terminal, thereby avoiding The problem that the terminal executes the above steps consumes the processing resources of the terminal excessively, thereby improving the performance of the terminal rendering the webpage and increasing the response speed of the webpage.

繼續參照圖4,本發明實施例中,一種網頁渲染系統,包括:伺服器200、第一資料庫300和第二資料庫400,所述第一資料庫300儲存有使用者代理資訊與設備資訊的映射關係,所述第二資料庫400儲存有與設備資訊對應的網頁文件,所述伺服器200接收終端100發送的攜帶使用者代理資訊的網頁請求,並從所述第一資料庫300中查詢與所述網頁請求中攜帶的使用者代理資訊對應的設備資訊,所述伺服器200從所述第二資料庫400獲取與所述設備資訊對應的網頁文件,並將獲取的所述網頁文件發送至終端100。 Continuing to refer to FIG. 4, in an embodiment of the present invention, a web page 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. Mapping relationship, the second database 400 stores a webpage file corresponding to device information, the server 200 receives a webpage request carrying user agent information sent from the terminal 100, and retrieves the webpage file from the first database 300 Querying device information corresponding to the user agent information carried in the webpage request, the server 200 obtains a webpage file corresponding to the device information from the second database 400, and will obtain the webpage file obtained 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 above system may further include: Web API (Application Programming Interface, Application Programming Development Interface) and TFS (Team Foundation Server, Decentralized File System) interface, the Web API and TFS interface are both based on the server 200 and the first database 300 to provide services to the upper business, 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-level services can call the above APIs, thereby facilitating the implementation of the services and enhancing the user experience.

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

本領域內的技術人員應明白,本發明的實施例可提供為方法、系統、或電腦程式產品。因此,本發明可採用完全硬體實施例、完全軟體實施例、或結合軟體和硬體方面的實施例的形式。而且,本發明可採用在一個或多個其中包含有電腦可用程式碼的電腦可用儲存媒體(包括但不限於磁碟記憶體、CD-ROM、光學記憶體等)上實施的電腦程式產品的形式。 Those skilled in the art should understand that the embodiments of the present invention may be provided as a method, a system, or a computer program product. Therefore, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software 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 magnetic disk memory, CD-ROM, optical memory, etc.) containing computer-usable code therein. .

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

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

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

還需要說明的是,用語“包括”、“包含”或者其任何其他變體意在涵蓋非排他性的包含,從而使得包括一系列要素的過程、方法、商品或者設備不僅包括那些要素,而且還包括沒有明確列出的其他要素,或者是還包括為這種過程、方法、商品或者設備所固有的要素。在沒有更多限制的情況下,由語句“包括一個......”限定的要素,並不排除在包括所述要素的過程、方法、商品或者設備中還存在另外的相同要素。 It should also be noted that the terms "including," "including," or any other variation thereof are intended to cover non-exclusive inclusion, so that a process, method, product, or device that includes a series of elements includes not only those elements, but also Other elements not explicitly listed, or those that are inherent to such a process, method, product, or device. Without more restrictions, the elements defined by the sentence "including a ..." do not exclude the existence of other identical elements in the process, method, product, or equipment that includes the elements.

本領域技術人員應明白,本發明的實施例可提供為方法、系統或電腦程式產品。因此,本發明可採用完全硬體 實施例、完全軟體實施例或結合軟體和硬體方面的實施例的形式。而且,本發明可採用在一個或多個其中包含有電腦可用程式碼的電腦可用儲存媒體(包括但不限於磁碟記憶體、CD-ROM、光學記憶體等)上實施的電腦程式產品的形式。 Those skilled in the art should understand that the embodiments of the present invention may be provided as a method, a system or a computer program product. Therefore, the present invention can be completely hardware Examples, full software examples, or a combination of software 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 magnetic disk memory, CD-ROM, optical memory, etc.) containing computer-usable code therein. .

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

本說明書中的各個實施例均採用遞進的方式描述,各個實施例之間相同相似的部分互相參見即可,每個實施例重點說明的都是與其他實施例的不同之處。尤其,對於系統實施例而言,由於其基本相似於方法實施例,所以描述的比較簡單,相關之處參見方法實施例的部分說明即可。 Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple. For the relevant part, refer 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 variations can be made in the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the scope of patent application of the present invention.

Claims (15)

一種網頁文件發送方法,包括:伺服器接收終端發送的攜帶與所述終端對應的使用者代理資訊的網頁請求;所述伺服器根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊;所述伺服器獲取與所述設備資訊對應的網頁文件並向所述終端發送。 A method for sending a webpage file includes: a server receives a webpage request sent by a terminal carrying user agent information corresponding to the terminal; and the server determines a correspondence with the user agent information according to the user agent information Device information of the terminal; the server obtains a webpage file corresponding to the device information and sends it to the terminal. 根據申請專利範圍第1項所述的方法,其中,所述伺服器獲取與所述設備資訊對應的網頁文件並向所述終端發送之前,所述方法還包括:所述伺服器根據所述設備資訊,確定與所述設備資訊對應的網頁文件的文件標識;所述伺服器向所述終端發送包含所述文件標識的文件;所述伺服器獲取與所述設備資訊對應的網頁文件並向所述終端發送,具體包括:所述伺服器接收所述終端發送的攜帶所述文件標識的文件獲取請求;所述伺服器回應於所述文件獲取請求,獲取與所述設備資訊對應的網頁文件並向所述終端發送。 The method according to item 1 of the scope of patent application, wherein before the server obtains a webpage file corresponding to the device information and sends it to the terminal, the method further includes: the server according to the device Information to determine a file identifier of a webpage file corresponding to the device information; the server sends a file containing the file identifier to the terminal; the server obtains a webpage file corresponding to the device information and sends the The terminal sending specifically includes: the server receiving a file acquisition request sent by the terminal carrying the file identifier; the server responding to the file acquisition request, acquiring a web file corresponding to the device information, and Sending to the terminal. 根據申請專利範圍第1項所述的方法,其中,所述伺服器根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊之前,所述方法還包括: 所述伺服器將使用者代理資訊和設備資訊的映射關係進行儲存;所述伺服器根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊,具體包括:所述伺服器根據預先產生的使用者代理資訊和設備資訊的映射關係,查找與所述使用者代理資訊相映射的所述終端的設備資訊;或,所述伺服器根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊之前,所述方法還包括:所述伺服器將設備資訊和特徵資訊的映射關係進行儲存;所述特徵資訊是所述使用者代理資訊中包含的;所述伺服器根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊,具體包括:所述伺服器提取所述使用者代理資訊中包含的特徵資訊;所述伺服器根據儲存的設備資訊和特徵資訊的映射關係,查詢與所述特徵資訊對應的所述終端的設備資訊。 The method according to item 1 of the scope of patent application, wherein before the server determines device information of the terminal corresponding to the user agent information according to the user agent information, the method further includes: The server stores a mapping relationship between user agent information and device information. The server determines device information of the terminal corresponding to the user agent information according to the user agent information, and specifically includes: The server searches for the device information of the terminal that is mapped to the user agent information according to the mapping relationship between the user agent information and the device information generated in advance; or the server according to the user agent information Before determining the device information of the terminal corresponding to the user agent information, the method further includes: storing, by the server, a mapping relationship between the device information and feature information; the feature information is the user Included in the agent information; the server determining device information of the terminal corresponding to the user agent information according to the user agent information specifically includes: the server extracts the user agent information from the user agent information The included feature information; the server queries and compares the stored information with the mapping information between the feature information and the feature information Sign information corresponding to apparatus information of the terminal. 根據申請專利範圍第3項所述的方法,其中,所述伺服器根據預先產生的使用者代理資訊和設備資訊的映射關係,查找與所述使用者代理資訊相映射的所述終端的設備資訊之後,所述方法還包括:若未查找到與所述使用者代理資訊相映射的所述終端 的設備資訊,則所述伺服器向所述終端返回與所述網頁請求對應的基本資源包;所述伺服器接收所述終端返回的與該終端對應的設備資訊和使用者代理資訊,產生返回的設備資訊和使用者代理資訊的映射關係並儲存。 The method according to item 3 of the scope of patent application, wherein the server searches for device information of the terminal mapped to the user agent information according to a mapping relationship between user agent information and device information generated in advance. After that, the method further includes: if the terminal mapped to the user agent information is not found The device information, the server returns the basic resource package corresponding to the webpage request to the terminal; the server receives the device information and user agent information corresponding to the terminal returned by the terminal, and generates a return And store the mapping between device information and user agent information. 根據申請專利範圍第1~4項中任一項所述的方法,其中,所述設備資訊包括顯示器資訊。 The method according to any one of claims 1 to 4, wherein the device information includes display information. 根據申請專利範圍第5項所述的方法,其中,所述顯示器資訊包括解析度資訊或像素密度資訊或螢幕尺寸資訊。 The method according to item 5 of the scope of patent application, wherein the display information includes resolution information or pixel density information or screen size information. 一種網頁渲染方法,包括:終端向伺服器發送攜帶與所述終端對應的使用者代理資訊的網頁請求;所述終端接收所述伺服器返回的與所述終端的設備資訊對應的網頁文件;所述終端接收的網頁文件是由所述伺服器根據所述設備資訊獲取到的,所述設備資訊是所述伺服器根據所述使用者代理資訊確定的;所述終端利用與所述設備資訊對應的網頁文件進行網頁的渲染。 A webpage rendering method includes: a terminal sends a webpage request to a server carrying user agent information corresponding to the terminal; the terminal receives a webpage file corresponding to the terminal's device information returned by the server; and The webpage file received by the terminal is obtained by the server according to the device information, and the device information is determined by the server based on the user agent information; the terminal uses a correspondence with the device information Webpage file for webpage rendering. 根據申請專利範圍第7項所述的方法,其中,所述終端接收所述伺服器返回的與所述終端的設備資訊對應的網頁文件之前,所述方法還包括:所述終端接收所述伺服器返回的文件;所述文件包含與所述終端的設備資訊對應的網頁文件的文件標識; 所述終端向所述伺服器發送攜帶所述文件標識的獲取請求;所述終端接收所述伺服器返回的與所述終端的設備資訊對應的網頁文件,具體包括:所述終端接收所述伺服器回應於所述獲取請求返回的與所述終端的設備資訊對應的網頁文件。 The method according to item 7 of the scope of patent application, wherein before the terminal receives a webpage file corresponding to the device information of the terminal returned by the server, the method further includes: the terminal receives the server A file returned by the browser; the file contains a file identifier of a webpage file corresponding to the device information of the terminal; Sending, by the terminal, an acquisition request carrying the file identifier to the server; and receiving, by the terminal, a web page file corresponding to the device information of the terminal returned by the server, specifically includes that the terminal receives the server The browser responds to the webpage file corresponding to the device information of the terminal returned by the acquisition request. 根據申請專利範圍第7項所述的方法,其中,所述方法還包括:若所述伺服器未確定到與所述使用者代理資訊對應的所述終端的設備資訊,則所述終端接收所述伺服器返回與所述網頁請求對應的基本資源包;所述終端利用所述基本資源包進行網頁載入,並採集與所述終端對應的設備資訊和使用者代理資訊;所述終端向所述伺服器發送所述設備資訊和與所述設備資訊對應的所述使用者代理資訊。 The method according to item 7 of the scope of patent application, wherein the method further comprises: if the server does not determine the device information of the terminal corresponding to the user agent information, the terminal receives the The server returns a basic resource package corresponding to the webpage request; the terminal uses the basic resource package to load a webpage, and collects device information and user agent information corresponding to the terminal; The server sends the device information and the user agent information corresponding to the device information. 根據申請專利範圍第7~9項中任一項所述的方法,其中,所述設備資訊包括顯示器資訊。 The method according to any one of claims 7 to 9, wherein the device information includes display information. 一種網頁文件發送裝置,包括:接收單元,確定單元,獲取單元及發送單元;所述接收單元接收終端發送的攜帶與所述終端對應的使用者代理資訊的網頁請求;所述確定單元根據所述使用者代理資訊,確定與所述使用者代理資訊對應的所述終端的設備資訊;所述獲取單元獲取與所述設備資訊對應的網頁文件;所述發送單元向所述終端發送與所述設備資訊對應的網頁文件。 A webpage file sending device includes: a receiving unit, a determining unit, an obtaining unit, and a sending unit; the receiving unit receives a webpage request sent by a terminal carrying user agent information corresponding to the terminal; and the determining unit is based on the User agent information to determine device information of the terminal corresponding to the user agent information; the obtaining unit obtains a web file corresponding to the device information; and the sending unit sends to the terminal the device corresponding to the device Web documents corresponding to the information. 根據申請專利範圍第11項所述的裝置,其中,所述裝置還包括:儲存單元,將使用者代理資訊和設備資訊的映射關係進行儲存;則所述確定單元根據儲存的使用者代理資訊和設備資訊的映射關係,查找與所述使用者代理資訊相映射的所述終端的設備資訊;或,所述裝置還包括:儲存單元,將設備資訊和特徵資訊的映射關係進行儲存;所述特徵資訊是所述使用者代理資訊中包含的;則所述確定單元包括:資訊提取單元和資訊查詢單元;所述資訊提取單元提取所述使用者代理資訊中包含的特徵資訊;所述資訊查詢單元根據儲存的設備資訊和特徵資訊的映射關係,查詢與所述特徵資訊對應的所述終端的設備資訊。 The device according to item 11 of the scope of patent application, wherein the device further comprises: a storage unit that stores a mapping relationship between user agent information and device information; and the determining unit is based on the stored user agent information and Mapping relationship of device information to find device information of the terminal that is mapped to the user agent information; or the device further includes: a storage unit that stores a mapping relationship between device information and feature information; the feature The information is included in the user agent information; then the determining unit includes: an information extraction unit and an information query unit; the information extraction unit extracts feature information included in the user agent information; the information query unit Query device information of the terminal corresponding to the characteristic information according to the mapping relationship between the stored device information and the characteristic information. 一種網頁渲染裝置,包括:發送單元,接收單元和渲染單元;所述發送單元向伺服器發送攜帶與終端對應的使用者代理資訊的網頁請求;所述接收單元接收所述伺服器返回的與所述終端的設備資訊對應的網頁文件;所述終端接收的網頁文件是由所述伺服器根據所述設備資訊獲取到的,所述設備資訊是所述伺服器根據所述使用者代理 資訊確定的;所述渲染單元利用與所述設備資訊對應的網頁文件進行網頁的渲染。 A webpage rendering device includes: a sending unit, a receiving unit, and a rendering unit; the sending unit sends a webpage request that carries user agent information corresponding to a terminal to a server; and the receiving unit receives The webpage file corresponding to the device information of the terminal; the webpage file received by the terminal is obtained by the server according to the device information, and the device information is the server according to the user agent The information is determined; the rendering unit uses a webpage file corresponding to the device information to render a webpage. 根據申請專利範圍第13項所述的裝置,其中,所述裝置還包括:文件接收單元,接收所述伺服器返回的文件;所述文件包含與終端的設備資訊對應的網頁文件的文件標識;請求發送單元,向所述伺服器發送攜帶所述文件標識的獲取請求;所述接收單元接收所述伺服器回應於所述獲取請求返回的與所述終端的設備資訊對應的網頁文件。 The device according to item 13 of the scope of patent application, 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 web page file corresponding to the device information of the terminal; The request sending unit sends an acquisition request carrying the file identifier to the server; the receiving unit receives a webpage file corresponding to the device information of the terminal returned by the server in response to the acquisition request. 一種網頁渲染系統,包括伺服器、第一資料庫和第二資料庫,所述第一資料庫儲存有使用者代理資訊與設備資訊的映射關係,所述第二資料庫儲存有與設備資訊對應的網頁文件,所述伺服器接收終端發送的攜帶使用者代理資訊的網頁請求,並從所述第一資料庫中查詢與所述網頁請求中攜帶的使用者代理資訊對應的設備資訊,所述伺服器從所述第二資料庫獲取與所述設備資訊對應的網頁文件,並將獲取的所述網頁文件發送至終端。 A webpage rendering system includes a server, a first database, and a second database. The first database stores a mapping relationship between user agent information and device information, and the second database stores a correspondence with device information. The webpage file, the server receives the webpage request carrying the user agent information sent by the terminal, and queries from the first database the device information corresponding to the user agent information carried in the webpage request, the The server obtains a webpage file corresponding to the device information from the second database, and sends the obtained webpage file to the terminal.
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
??201610488238.2 2016-06-28
CN201610488238.2A CN106897336A (en) 2016-06-28 2016-06-28 Web page files sending method, webpage rendering intent and device, webpage rendering system

Publications (2)

Publication Number Publication Date
TW201800962A true TW201800962A (en) 2018-01-01
TWI670611B 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 (13)

* 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
CN113486634A (en) * 2021-07-07 2021-10-08 上海中通吉网络技术有限公司 Questionnaire editor subassembly
CN114491355A (en) * 2021-12-17 2022-05-13 浙江百应科技有限公司 Webpage system version rollback method and device, electronic equipment and storage medium

Family Cites Families (7)

* 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
CN100481088C (en) * 2007-06-07 2009-04-22 北京大学 Web page resource issuing method and issuing system
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
CN104462131A (en) * 2013-09-23 2015-03-25 阿里巴巴集团控股有限公司 Method and device for processing information issuing page
CN104462231B (en) * 2014-11-11 2018-12-04 北京奇安信科技有限公司 The method, apparatus and system of webpage rendering

Also Published As

Publication number Publication date
CN106897336A (en) 2017-06-27
TWI670611B (en) 2019-09-01
WO2018001124A1 (en) 2018-01-04

Similar Documents

Publication Publication Date Title
TWI670611B (en) Web file sending method, webpage rendering method and device, webpage rendering system
US8527862B2 (en) Methods for making ajax web applications bookmarkable and crawlable and devices thereof
US10346501B2 (en) Mobile enablement of existing web sites
WO2015161658A1 (en) Webpage resource loading method and device
US9594477B1 (en) Using deep links to restore interactive state of a web page
CN106911693B (en) Method and device for detecting hijacking of webpage content and terminal equipment
CN110221871B (en) Webpage acquisition method and device, computer equipment and storage medium
CN105095280A (en) Caching method and apparatus for browser
JP6140904B2 (en) Terminal marking method, terminal marking device, program, and recording medium
CN111104587A (en) Webpage display method and device and server
US20170032494A1 (en) Methods for displaying a webpage fragment on a desktop and systems for taking a snapshot of webpage fragment for displaying on a desktop
CN104572843A (en) Page loading method and device
TW201437826A (en) Method and device for combining webpage style address
US20140095579A1 (en) System and method for increasing web site serving performance
CN110808868B (en) Test data acquisition method and device, computer equipment and storage medium
JP5604016B1 (en) Script caching method and information processing apparatus using the same
US10574773B2 (en) Method, device, terminal, server and storage medium of processing network request and response
CN109670100B (en) Page data capturing method and device
CN113452733A (en) File downloading method and device
CN114003835A (en) Page rendering method, device, equipment and storage medium
US10095791B2 (en) Information search method and apparatus
CN105808727A (en) Website cross-screen adaptation technology architecture and adaptation method based on HTML5 (Hypertext Markup Language 5)
CN109344344A (en) Identification method, server and the computer readable storage medium of webpage client
CN106776961B (en) Webpage local storage space expansion method, browser client and electronic equipment
JP6378601B2 (en) Content analysis apparatus, content analysis method, and program