WO2018001124A1 - Webpage file sending method, webpage rendering method and apparatus, and webpage rendering system - Google Patents

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

Info

Publication number
WO2018001124A1
WO2018001124A1 PCT/CN2017/088637 CN2017088637W WO2018001124A1 WO 2018001124 A1 WO2018001124 A1 WO 2018001124A1 CN 2017088637 W CN2017088637 W CN 2017088637W WO 2018001124 A1 WO2018001124 A1 WO 2018001124A1
Authority
WO
WIPO (PCT)
Prior art keywords
terminal
information
webpage
server
device information
Prior art date
Application number
PCT/CN2017/088637
Other languages
French (fr)
Chinese (zh)
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 WO2018001124A1 publication Critical patent/WO2018001124A1/en

Links

Images

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

Definitions

  • the present application relates to the field of Internet technologies, and in particular, to a webpage file sending method, a webpage rendering method and apparatus, and a webpage rendering system.
  • 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.
  • CSS Clicking Style Sheets
  • the terminal in the process of requesting a webpage through a browser or a client, first, the terminal sends a webpage request to the server, and then, in response to the webpage request, the server returns to the terminal, which may be used during the webpage loading process.
  • Web page file After receiving the webpage file returned by the server, the terminal needs to detect its own device information, and uses a media query method to determine a webpage style that is adapted to the device information and a loading required to render the webpage style.
  • Web page file After receiving the webpage file returned by the server, the terminal needs to detect its own device information, and uses a media query method to determine a webpage style that is adapted to the device information and a loading required to render the webpage style.
  • the terminal may select a webpage file (such as a CCS file, a picture, etc.) currently
  • the media query method is needed to determine the webpage style that is adapted to the device information of the terminal, and the webpage file that needs to be loaded to render the webpage style, and select the currently loaded webpage from the webpage file returned by the server. 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.
  • the purpose of the embodiment of the present application is to provide a webpage file sending method, a webpage rendering method and device, and a webpage rendering Dyeing systems to solve the above problems in the prior art.
  • the webpage file sending method, the webpage rendering method and apparatus, and the webpage rendering system provided by the embodiments of the present application are implemented as follows:
  • a method for sending a webpage file comprising:
  • the server receives a webpage request sent by the terminal and carries user agent information corresponding to the terminal;
  • the server acquires a webpage file corresponding to the device information and sends the webpage file to the terminal.
  • a web page rendering method comprising:
  • the terminal Receiving, by the terminal, 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.
  • 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 The user agent information, the device information of the terminal corresponding to the user agent information is determined; the obtaining unit acquires a webpage file corresponding to the device information; and the sending unit sends a corresponding to the device information to the terminal Web page file.
  • 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; the receiving unit receives the terminal returned by the server and the terminal The webpage file corresponding to the device information; the device information is determined by the server according to the user agent information; and 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 a webpage file corresponding to device information.
  • 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 types corresponding to the device according to the device information.
  • the webpage file is sent to the terminal, so that the terminal performs rendering of the webpage by using the webpage file corresponding to the device information.
  • FIG. 1 is a flowchart of a webpage request process according to an embodiment of the present application
  • Figure 2 shows an example of displaying different web page styles on different terminals
  • FIG. 3 is a flowchart of a method for sending a webpage file based on a server according to an embodiment of the present application
  • FIG. 4 is a schematic diagram of a webpage rendering apparatus and a webpage file sending apparatus according to an embodiment of the present application.
  • a web page can be displayed in various browsers or clients of a client or application APP, and a browser or client loads various webpage files and uses the webpage file to render the webpage speed. It directly affects the user experience.
  • the rendering process of a web page refers to the HTML (Hyper Text Mark-up Language) returned by the server (web server or application server) according to the rules defined by CSS (Cascading Style Sheets). , Hypertext Markup Language) The process of displaying code in a browser or client window.
  • FIG. 1 is a process of requesting a webpage according to an embodiment of the present application, where the process is completed by a terminal and a server.
  • the user requests access to a webpage by inputting a certain web address (domain name) in a browser or a client on the terminal, and the server is a server corresponding to the web address requested by the terminal.
  • the foregoing webpage request process includes the following steps:
  • Step S101 The terminal sends a webpage request carrying the user agent information corresponding to the terminal to the server.
  • a user can request access to a web page by entering a web address in a browser or client of the terminal.
  • the terminal needs to send a web page request (ie, an HTTP request) to the server corresponding to the web address.
  • a web page request ie, an HTTP request
  • the browser or the client Before sending the above webpage request, the browser or the client first needs to establish a connection with the web server through the network, and the connection can be completed by using the TCP protocol.
  • the browser or client can send a web page request to the server.
  • the webpage request may include: a request method URI protocol/version, a request header (Request Header) information, and a request body.
  • the request header information may include some information corresponding to the client environment and information corresponding to the request body. For example, the request header information can declare the language used by the browser or client, the length of the request body, and the like.
  • Mozila/4.0 compatible; MSIE5.01; Window NT5.0
  • 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:
  • a line may generally be blank between the request header information and the request body, indicating that the request header information has ended, followed by the request body.
  • the request body has only one line of content. Of course, in practical applications, the request body can contain more content.
  • the webpage request includes user-agent (UA) information
  • the user agent information refers to the identifier information unique to the browser or the client of the terminal, including: a hardware platform, system software, and application software. And personal preferences of the user.
  • UUA user-agent
  • An example of user agent information for a mobile terminal is as follows:
  • Step S102 The server determines device information corresponding to the user agent information according to the user agent 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 client of the terminal needs to be based on the terminal.
  • Device information to determine In the embodiment of the present application, after receiving the webpage request, the server determines the device information corresponding to the terminal that sends the webpage request.
  • the device information includes, but is not limited to, display information of the terminal, other hardware information of the terminal, operating system information of the terminal, and the like.
  • the display information may include resolution information of the screen, or pixel density information, or a size of the screen, and the like.
  • a webpage style adapted to the device information can be rendered.
  • Figure 2 shows an example of displaying different web page styles on different terminals.
  • the terminals 10, 20 each have different device information, such as different resolutions of the screen.
  • a certain webpage includes webpage modules A, B, and C, and the webpage module may be, for example, a picture, a text, a button, or the like.
  • the rendered webpage styles may be different, and different webpage styles may be embodied in the size of the text, the position and layout of the webpage module, and the like.
  • the method before the step S102, the method further includes the following steps:
  • the server pre-generates a mapping relationship between user agent information and device information, and the generated mapping relationship may be stored in a database of the web server.
  • step S102 specifically includes:
  • the server searches 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 that are generated in advance.
  • the server may extract the carried user agent information from the webpage request, and search the pre-formed database according to the user proxy information to find To device information mapped to the user agent information.
  • the server may extract the carried user agent information from the webpage request, and search the pre-formed database according to the user proxy information to find To device information mapped to the user agent information.
  • device information such as display information
  • the server may extract the carried user agent information from the webpage request, and search the pre-formed database according to the user proxy information to find To device information mapped to the user agent information.
  • device information such as display information
  • the method may further include the following steps:
  • 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 feature information may be any one of the following: device brand model information, operating system information of the device, and the like.
  • a user agent information is: Mozilla/5.0 (Linux; U; Android 4.1.1; zh-cn; GT-I9100Build/JRO03H; CyanogenMod-10) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0Mobile Safari/534.30
  • the device brand model information is: "GT-I9100”
  • the operating system information of the device is: "Android 4.1.1”.
  • 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 mapping relationship between the device information and the feature information described above is configured by the administrator (ie, not necessarily generated by the server).
  • step S102 may specifically include the following steps:
  • 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.
  • 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) The size information is: 4.3 inches); for example, the server can determine the possible range of device information corresponding to "Android 4.1.1” by extracting the operating system information carried in the user agent information: "Android 4.1.1". Interval (eg, the size of the screen is: 3.0 to 5.3 inches, the pixel information of the screen is: (480px ⁇ 800px) * (800px ⁇ 1280px)).
  • Step S103 The server acquires a webpage file corresponding to the device information and sends the webpage file to the terminal.
  • the webpage file may include: an HTML file, a CSS file, a JS (JavaScript) file, a picture, etc. Wait. Web pages are generally rendered based on the various web page files described above.
  • the webpage file may also be referred to as a webpage resource, and the webpage resource may include a static resource and a dynamic resource.
  • the method before the step S103, the method further includes the following steps:
  • 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 (Uniform Resource Locator) or a file of a webpage file.
  • the URL is for example:
  • 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”
  • 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”.
  • the server sends a file (ie, an HTML file) containing the file identifier to the terminal.
  • a file ie, an HTML file
  • the server (the server of the web server or the application APP) needs to return a corresponding HTTP response (HTTP Response) to the terminal in response to the webpage request (HTTP request) sent by the terminal.
  • HTTP response ie, the above HTML file
  • the HTTP response may include: protocol status version code description information, Response Header information, and response body.
  • the returned HTML response may include the file identifier determined above, 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 client needs to adopt in the subsequent webpage rendering process.
  • 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 file identifiers of the remaining webpage files that need not be loaded.
  • the above CSS file needs to be returned to the terminal: "400.css” and "800.css
  • 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).
  • the embodiment of the present application can specifically return a webpage file corresponding to the device information to the terminal according to different screen resolutions (device information) of the terminal.
  • step S103 specifically includes the following steps:
  • the server receives a file acquisition request sent by the terminal and carries the file identifier.
  • the browser or the client can obtain various webpage files (such as CSS files and pictures) embedded in the current webpage style by sending a corresponding file acquisition request to the server.
  • the file acquisition request carries the URL of the webpage file.
  • the server sends a webpage file corresponding to the file identifier to the terminal in response to the file acquisition request.
  • the server may determine the 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 client) sends the HTTP request to the server, it may not need to send to the server to obtain each A file acquisition request for a web page file.
  • Step S104 The terminal receives the webpage file corresponding to the device information, and performs rendering of the webpage by 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 well known in the art, it will not be described in detail herein.
  • FIG. 3 is a flowchart of a method for sending a webpage file based on a server according to an embodiment of the present application.
  • the method for sending a webpage file includes the following steps:
  • the server receives a webpage request sent by the terminal and carries user agent information corresponding to the terminal.
  • the server determines device information of the terminal corresponding to the user agent information according to the user agent information.
  • S204 The server acquires a webpage file corresponding to the device information, and sends the webpage file to the terminal.
  • 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.
  • the foregoing method for sending a webpage file further includes:
  • Step S203 It is determined 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.
  • 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 to the web page style that matches the device information. 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 selects the webpage file to be loaded from the basic resource package, and finally uses the selected webpage file to render the webpage.
  • 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 to the web page style that matches the device information.
  • 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 selects the webpage file to be
  • 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.
  • the terminal can dynamically collect the device information of the current terminal through a certain method (such as JavaScript) while performing webpage rendering, such as: resolution information of the screen, pixel density of the screen. Information, screen size information, operating system information used, hardware platform information, and more.
  • a certain method such as JavaScript
  • webpage rendering such as: resolution information of the screen, pixel density of the screen.
  • Information screen size information, operating system information used, hardware platform information, and more.
  • Step S207 The server generates a mapping relationship between the returned device information and the user agent information and stores it.
  • 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 data in the database.
  • a webpage rendering method provided by an embodiment of the present application 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.
  • 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 determining, according to the device information, various webpage files corresponding to the device and sending the webpage file to the terminal, so that the terminal performs rendering of the webpage by using the webpage file corresponding to the device information.
  • 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.
  • the webpage file required by the webpage rendering process, and avoiding returning other webpage files that do not need to be loaded to the above terminal can reduce the consumption of network resources to a certain extent.
  • the terminal since the terminal (browser or client) generally needs to collect its own device information, and uses a Media Query method to determine the webpage 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 is added (that is, the network resource is additionally consumed), resulting in poor loading performance, the following problems exist in the prior art: before the terminal performs webpage rendering It is necessary to determine the device information of the device, and also need to use the media query method to determine the webpage file to be loaded, and select the webpage file to be loaded from the webpage file returned by the server. To some extent, the terminal needs to perform the above steps.
  • the terminal also needs to consider which webpage style is to be rendered, and which webpage conditions need to be applied, which will inevitably affect the performance of the webpage rendered by the browser or the client, and reduce the response of the webpage. speed. It can be seen that, by using the foregoing method provided by the embodiment of the present application, before the webpage is rendered, determining the device information of the terminal and determining that the webpage file corresponding to the device information is performed by the server, avoiding performing the foregoing process by the terminal, thereby avoiding The terminal performs the above steps to excessively consume the processing resources of the terminal, thereby improving the performance of the terminal rendering the webpage and improving the response speed of the webpage.
  • 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.
  • the execution subject of step S201 and step S202 may be device 1
  • the execution subject of step S203 may be device 2
  • the execution subject of step S201 may be device 1
  • the execution subject of step S202 and step S203 may be device 2 ;and many more.
  • FIG. 4 is a schematic diagram of a webpage rendering apparatus and a webpage file sending apparatus according to an embodiment of the present application.
  • the terminal 100 includes a browser or client 101, a webpage rendering apparatus 110, and the server 200 includes a webpage file transmitting apparatus 210, wherein the webpage rendering apparatus 110 and the webpage file transmitting apparatus 210 are
  • the terminal 100 and the server 200 may be present in software, hardware, or a combination of hardware and software, respectively.
  • the server 200 and the terminal 100 described above 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 nonvolatile memory, a bus, an input/output device, and the like.
  • the above terminal 100 and server 200 also 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 implemented by referring to the webpage rendering method. The content of the example will not be repeated here. Similarly, the specific details of the webpage file transmitting apparatus may refer to the content of the embodiment of the webpage file transmitting method.
  • 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, according to the user agent information, that the user agent information is corresponding to the user agent information.
  • the device information of the terminal; 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 may search for the device information corresponding to the user agent information by searching the first database 300.
  • the first database 300 may pre-store the mapping relationship between the user agent information and the device information.
  • the foregoing obtaining unit 215 may acquire various webpage files by sending a request to the second database 400, and the sent request may be HTTP header information carrying the device information.
  • the foregoing second database 400 can be stored in various webpage files (resources), such as: HTML files, CSS files, pictures, 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.
  • the embodiment of the present application can achieve at least the following technical effects:
  • the server 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.
  • the webpage file required by the webpage rendering process, and avoiding returning other webpage files that do not need to be loaded to the above terminal, can reduce the consumption of network resources to a certain extent.
  • the foregoing method provided by the embodiment of the present application determines the device information of the terminal and determines that the webpage file corresponding to the device information is executed by the server before the rendering of the webpage, thereby avoiding performing the foregoing process by the terminal, thereby avoiding 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 webpage and improving the response speed of the webpage.
  • the webpage file sending apparatus 210 further includes:
  • the determining unit 213 searches 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 that are generated in advance;
  • the webpage file sending apparatus 210 further includes:
  • a generating unit configured to generate a mapping relationship between the device information and the feature information in advance; 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 mapping of the information query unit according to the device information and the feature information generated in advance And determining device information of the terminal corresponding to the feature information.
  • 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 according to the user agent The information is determined; the rendering unit 115 performs rendering of the webpage by using a webpage file corresponding to the device information.
  • the webpage rendering apparatus 110 further includes:
  • a file receiving unit configured to receive a file returned by the server; the file includes a file identifier of a webpage file corresponding to device information of the terminal;
  • the receiving unit 113 receives a webpage file corresponding to the device information of the terminal returned by the server in response to the obtaining request.
  • the embodiment of the present application can achieve at least the following technical effects:
  • 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.
  • the webpage file required by the webpage rendering process, and avoiding returning other webpage files that do not need to be loaded to the above terminal, can reduce the consumption of network resources to a certain extent.
  • the foregoing method provided by the embodiment of the present application determines the device information of the terminal and determines the webpage text corresponding to the device information before the webpage is rendered.
  • the device is executed by the server, which avoids the above-mentioned process performed 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.
  • a webpage rendering system includes: a server 200, a first database 300, and a second database 400.
  • the first database 300 stores a mapping relationship between 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 carries the user agent information sent by the terminal 100, and queries from the first database 300 to carry with the webpage request.
  • the server 200 obtains the webpage file corresponding to the device information from the second database 400, and sends the obtained webpage file to the terminal 100.
  • the foregoing system may further include: a Web API (Application Programming Interface) and a TFS (Team Foundation Server) interface, the Web API and the TFS interface. Both are based on the two interfaces of the server 200 and the first database 300 for providing services to the upper layer service, and the above Web API and the TFS interface may be used to return different results (such as HTML and pictures) from the second database 400. Etc.) is packaged into a corresponding API (such as Ajax), so that various upper-layer services can call the above API, thereby facilitating the implementation of the service and enhancing the user experience.
  • a Web API Application Programming Interface
  • TFS Team Foundation Server
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions can also be stored in a particular computer capable of booting a computer or other programmable data processing device In a computer readable memory that operates in a computer readable memory, causing instructions stored in the computer readable memory to produce an article of manufacture comprising instruction means implemented in a block or in a flow or a flow diagram and/or block diagram of the flowchart The functions specified in the boxes.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
  • embodiments of the present application can be provided as a method, system, or computer program product.
  • the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment in combination of software and hardware.
  • the application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • the application can be described in the general context of computer-executable instructions executed by a computer, such as a program module.
  • program modules include routines, programs, objects, components, data structures, and the like that perform particular tasks or implement particular abstract data types.
  • the present application can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are connected through a communication network.
  • program modules can be located in both local and remote computer storage media including storage devices.

Abstract

A webpage file sending method, a webpage rendering method and apparatus, and a webpage rendering system. The webpage file sending method comprises: a server receiving a webpage request sent by a terminal and carrying user agent information corresponding to the terminal; according to the user agent information, the server determining device information, corresponding to the user agent information, about the terminal; and the server acquiring a webpage file corresponding to the device information and sending same to the terminal. Before webpage rendering, the determination of device information about a terminal and the determination of a webpage file corresponding to the device information are both executed by a server, so that the problem of excessively consuming processing resources of the terminal due to the fact that the terminal executes the above-mentioned steps is avoided, so as to improve the performance of the terminal in rendering a webpage.

Description

网页文件发送方法、网页渲染方法及装置、网页渲染系统Web file sending method, webpage rendering method and device, webpage rendering system
本申请要求2016年06月28日递交的申请号为201610488238.2、发明名称为“网页文件发送方法、网页渲染方法及装置、网页渲染系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority from the Chinese Patent Application No. 201610488238.2, entitled "Web File Sending Method, Web Page Rendering Method and Apparatus, Web Page Rendering System", which is filed on June 28, 2016, the entire contents of which are incorporated by reference. In this application.
技术领域Technical field
本申请涉及互联网技术领域,特别涉及一种网页文件发送方法、网页渲染方法及装置、网页渲染系统。The present application relates to the field of Internet technologies, and in particular, to a webpage file sending method, a webpage rendering method and apparatus, and a webpage rendering system.
背景技术Background technique
现如今,通过浏览器或应用APP的客户端访问各种网页已成为人们获取信息的渠道之一。目前,人们所使用的各种终端往往具备不同的设备信息(如:终端屏幕的大小),而针对终端所具备的设备信息的不同,可在终端上展示不同的网页样式。例如,新浪网(http://www.sina.com.cn/)在手机和电脑上是以不同的网页样式进行展示的。Nowadays, accessing various web pages through the browser of the browser or application app has become one of the channels 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 through a browser or a client, first, the terminal sends a webpage request to the server, and then, in response to the webpage request, the server returns to the terminal, which may be used during the webpage loading process. Web page file. After receiving the webpage file returned by the server, the terminal needs to detect its own device information, and uses a media query method to determine a webpage style that is adapted to the device information and a loading required to render the webpage style. Web page file. 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 that is adapted to the device information of the terminal, and the webpage file that needs to be loaded to render the webpage style, and select the currently loaded webpage from the webpage file returned by the server. 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.
发明内容Summary of the invention
本申请实施例的目的是提供一种网页文件发送方法、网页渲染方法及装置、网页渲 染系统,以解决现有技术中存在的上述问题。The purpose of the embodiment of the present application is to provide a webpage file sending method, a webpage rendering method and device, and a webpage rendering Dyeing systems 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 embodiments of the present application are implemented as follows:
一种网页文件发送方法,包括:A method for sending a webpage file, comprising:
服务器接收终端发送的携带与所述终端对应的用户代理信息的网页请求;The server receives a webpage request sent by the terminal and carries user agent information corresponding to the terminal;
所述服务器根据所述用户代理信息,确定与所述用户代理信息对应的所述终端的设备信息;Determining, by the server, 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 webpage file to the terminal.
一种网页渲染方法,包括:A web page rendering method, comprising:
终端向服务器发送携带与所述终端对应的用户代理信息的网页请求;Sending, by the terminal, a webpage request that carries user agent information corresponding to the terminal to the server;
所述终端接收所述服务器返回的与所述终端的设备信息对应的网页文件;所述设备信息是所述服务器根据所述用户代理信息确定的;Receiving, by the terminal, 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.
一种网页文件发送装置,包括:接收单元,确定单元,获取单元及发送单元;所述接收单元接收终端发送的携带与所述终端对应的用户代理信息的网页请求;所述确定单元根据所述用户代理信息,确定与所述用户代理信息对应的所述终端的设备信息;所述获取单元获取与所述设备信息对应的网页文件;所述发送单元向所述终端发送与所述设备信息对应的网页文件。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 The user agent information, the device information of the terminal corresponding to the user agent information is determined; the obtaining unit acquires a webpage file corresponding to the device information; and the sending unit sends a corresponding to the device information to the terminal Web page file.
一种网页渲染装置,包括:发送单元,接收单元和渲染单元;所述发送单元向服务器发送携带与终端对应的用户代理信息的网页请求;所述接收单元接收所述服务器返回的与所述终端的设备信息对应的网页文件;所述设备信息是所述服务器根据所述用户代理信息确定的;所述渲染单元利用与所述设备信息对应的网页文件进行网页的渲染。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; the receiving unit receives the terminal returned by the server and the terminal The webpage file corresponding to the device information; the device information is determined by the server according to the user agent information; and 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 a webpage file corresponding to device information. Receiving, by the server, a webpage request that is sent by the terminal and carrying the user agent information, and querying, from the first database, device information corresponding to the user agent information carried in the webpage request, where the server obtains from the second database And the webpage file corresponding to the device information, and sending the obtained webpage file to the terminal.
本申请实施例采用的上述至少一个技术方案能够达到以下有益效果:The above at least one technical solution adopted by the embodiment of the present application 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 types corresponding to the device according to the device information. The webpage file is sent to the terminal, so that the terminal performs rendering of the webpage by using the webpage file corresponding to the device information. Compared with the prior art, 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, the execution of the foregoing process by the terminal is avoided, thereby avoiding that the terminal performs the above steps. Excessive consumption of processing resources of the terminal, improving the performance of the terminal.
附图说明DRAWINGS
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings to be used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description are only It is a few embodiments described in the present application, and other drawings can be obtained from those skilled in the art without any inventive labor.
图1为本申请一实施例提供的网页请求过程的流程图;FIG. 1 is a flowchart of a webpage request process according to an embodiment of the present application;
图2示出了在不同终端上显示不同的网页样式的示例;Figure 2 shows an example of displaying different web page styles on different terminals;
图3为本申请一实施例提供的以服务器为主体的网页文件发送方法的流程图;FIG. 3 is a flowchart of a method for sending a webpage file based on a server according to an embodiment of the present application;
图4为本申请一实施例提供的网页渲染装置和网页文件发送装置的示意图。FIG. 4 is a schematic diagram of a webpage rendering apparatus and a webpage file sending apparatus according to an embodiment of the present application.
具体实施方式detailed description
为了使本技术领域的人员更好地理解本申请中的技术方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。The technical solutions in the embodiments of the present application are clearly and completely described in the following, in which the technical solutions in the embodiments of the present application are clearly and completely described. The embodiments are only a part of the embodiments of the present application, and not all of them. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without departing from the inventive scope shall fall within the scope of the application.
目前,网页(Web)页面可以在各种浏览器或客户端或应用APP的客户端中进行展示,而浏览器或客户端载入各种网页文件、并利用所述网页文件渲染网页页面的速度,直接影响着用户的使用体验。网页页面的渲染过程是指:浏览器或客户端根据CSS(Cascading Style Sheets,层叠样式表)定义的规则,将服务器(Web服务器或应用APP的服务端)返回的HTML(Hyper Text Mark-up Language,超文本标记语言)代码显示在浏览器或客户端的窗口中的过程。Currently, a web page can be displayed in various browsers or clients of a client or application APP, and a browser or client loads various webpage files and uses the webpage file to render the webpage speed. It directly affects the user experience. The rendering process of a web page refers to the HTML (Hyper Text Mark-up Language) returned by the server (web server or application server) according to the rules defined by CSS (Cascading Style Sheets). , Hypertext Markup Language) The process of displaying code in a browser or client window.
针对现有技术中存在的服务器可能将部分不需被加载的网页文件返回至所述终端的问题,本文提出如下技术方案以至少解决这一问题。In view of the problem that a server existing 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 to solve at least this problem.
图1为本申请一实施例提供的网页请求的过程,该过程由终端和服务器来共同完成, 用户通过在所述终端上的浏览器或客户端中输入某网址(域名)来请求访问某网页,所述服务器是与上述终端所请求访问的网址对应的服务器。本实施例中,上述网页请求过程包括如下步骤:FIG. 1 is a process of requesting a webpage according to an embodiment of the present application, where the process is completed by a terminal and a server. The user requests access to a webpage by inputting a certain web address (domain name) in a browser or a client on the terminal, and 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, a user can request access to a web page by entering a web address in a browser or client of the terminal. After entering the web address, the terminal needs to send a web page request (ie, an HTTP request) to the server corresponding to the web address. Before sending the above webpage request, the browser or the client first needs to establish a connection with the web server through the network, and the connection can be completed by using the TCP protocol. Once the terminal establishes a connection with the server, the browser or client can send a web page request to the server. The webpage request may include: a request method URI protocol/version, a request header (Request Header) information, and a request body. The request header information may include some information corresponding to the client environment and information corresponding to the request body. For example, the request header information can declare the language used by the browser or client, the length of the request body, and the like.
以下是一个网页请求的例子:The following is an example of a web request:
GET/sample.jspHTTP/1.1GET/sample.jspHTTP/1.1
Accept:image/gif.image/jpeg,*/*Accept:image/gif.image/jpeg,*/*
Accept-Language:zh-cnAccept-Language: zh-cn
Connection:Keep-AliveConnection: Keep-Alive
Host:localhostHost:localhost
User-Agent:Mozila/4.0(compatible;MSIE5.01;Window NT5.0)User-Agent: Mozila/4.0 (compatible; MSIE5.01; Window NT5.0)
Accept-Encoding:gzip,deflateAccept-Encoding: gzip, deflate
username=jinqiao&password=1234Username=jinqiao&password=1234
在以上例子中,网页请求的第一行是“方法URL议/版本”:GET/sample.jsp HTTP/1.1;请求头(Request Header)信息是: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:image/gif.image/jpeg.*/*
Accept-Language:zh-cnAccept-Language: zh-cn
Connection:Keep-AliveConnection: Keep-Alive
Host:localhostHost:localhost
User-Agent:Mozila/4.0(compatible:MSIE5.01:Windows NT5.0)User-Agent: Mozila/4.0 (compatible: MSIE5.01: Windows NT5.0)
Accept-Encoding:gzip,deflateAccept-Encoding: gzip, deflate
请求头信息和请求正文之间一般可以空一行,表示请求头信息已经结束,接下来的是请求正文。在上述例子中,请求正文可以包含用户提交的查询字符串信息: username=jinqiao&password=1234。在以上例子中,请求正文只有一行内容。当然,在实际应用中,请求正文可以包含更多的内容。A line may generally 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 can contain 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)信息,用户代理信息是指上述终端的浏览器或客户端所特有的标识信息,包括:硬件平台、系统软件、应用软件和用户个人偏好等。一种移动终端的用户代理信息的示例如下:In the embodiment of the present application, the webpage request includes user-agent (UA) information, and the user agent information refers to the identifier information unique to the browser or the client of the terminal, including: a hardware platform, system software, and application software. And personal preferences of the user. 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-I9100Build/JRO03H;CyanogenMod-10)AppleWebKit/534.30(KHTML,like Gecko)Version/4.0Mobile Safari/534.30Mozilla/5.0 (Linux; U; Android 4.1.1; zh-cn; GT-I9100Build/JRO03H; CyanogenMod-10) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0Mobile 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 client of the terminal needs to be based on the terminal. Device information to determine. In the embodiment of the present application, after receiving the webpage request, the server determines the device information corresponding to the terminal that sends the webpage request. The device information includes, but is not limited to, display information of the terminal, other hardware information of the terminal, operating system information of the terminal, and the like. The display information may include resolution information of the screen, or pixel density information, or a size of the screen, and the like. 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 this FIG. 2, the terminals 10, 20 each have different device information, such as different resolutions of the screen. It is assumed that a certain webpage includes webpage modules A, B, and C, and 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 embodied in the size of the text, the position and layout of the webpage module, and the like.
本申请一实施例中,在上述步骤S102之前,所述方法还包括如下步骤:In an embodiment of the present application, before the step S102, the method further includes the following steps:
服务器预先生成用户代理信息和设备信息的映射关系,生成的映射关系可以存储于Web服务器的数据库中。The server pre-generates a mapping relationship between user agent information and device information, and the generated mapping relationship may be stored in a database of the web server.
举例而言:与用户代理信息:“Mozilla/5.0(Linux;U;Android 4.1.1;zh-cn;GT-I9100Build/JRO03H;CyanogenMod-10)AppleWebKit/534.30(KHTML,like Gecko)Version/4.0Mobile Safari/534.30”相映射的设备信息为:480px*800px;与用户代理信息:“Mozilla/5.0(Windows;U;Windows NT 5.1;en-US;rv:0.9.4)Gecko/20011128Netscape6/6.2.1”相映射的设备信息为:1920px*1080px;等等。 For example: with user agent information: "Mozilla/5.0 (Linux; U; Android 4.1.1; zh-cn; GT-I9100Build/JRO03H; CyanogenMod-10) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0Mobile 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/20011128Netscape6/6.2.1 The phase-mapped device information is: 1920px*1080px; and so on.
相应地,上述步骤S102具体包括:Correspondingly, the foregoing step S102 specifically includes:
服务器根据预先生成的用户代理信息和设备信息的映射关系,查找与所述用户代理信息相映射的所述终端的设备信息。The server searches 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 that are generated in advance.
通过上述方法,服务器在接收到终端(浏览器或客户端)发送的网页请求之后,可以从该网页请求中提取所携带的用户代理信息,并依据该用户代理信息查找预先形成的数据库,以查找到与该用户代理信息相映射的设备信息。一般地,数据库中针对每一个用户代理信息,会存在唯一与该用户代理信息相映射的设备信息(如显示器信息)。当然,也存在因数据库中没有存在相应的记录,而导致无法查找到与当前用户代理信息相映射的设备信息的可能性,对于这一情况,将在下文具体介绍解决方案。After receiving the webpage request sent by the terminal (browser or client), the server may extract the carried user agent information from the webpage request, and search the pre-formed database according to the user proxy information to find To device information mapped to the user agent information. Generally, for each user agent information in the database, there will be device information (such as display information) uniquely mapped to the user agent information. Of course, there is also the 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 case, the solution will be specifically described below.
值得一提的是,本申请其他实施例中,在上述步骤S102之前,所述方法还可以包括如下步骤:It is to be noted that, in other embodiments of the present application, before the step S102, the method may further include the following steps:
服务器将设备信息和特征信息的映射关系进行存储;其中,所述特征信息是所述用户代理信息中包含的。上述特征信息可以是如下任意一种:设备品牌型号信息、设备的操作系统信息等。举例来说,一条用户代理信息是:Mozilla/5.0(Linux;U;Android 4.1.1;zh-cn;GT-I9100Build/JRO03H;CyanogenMod-10)AppleWebKit/534.30(KHTML,like Gecko)Version/4.0Mobile 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 feature information may be any one of the following: device brand model information, operating system information of the device, and the like. For example, a user agent information is: Mozilla/5.0 (Linux; U; Android 4.1.1; zh-cn; GT-I9100Build/JRO03H; CyanogenMod-10) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0Mobile Safari/534.30, the device brand model information is: "GT-I9100", the operating system information of the device 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 mapping relationship between the device information and the feature information described above is configured by the administrator (ie, 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英寸);再例如,服务器通过提取用户代理信息中所携带的操作系统信息:“Android4.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) The size information is: 4.3 inches); for example, the server can determine the possible range of device information corresponding to "Android 4.1.1" by extracting the operating system information carried in the user agent information: "Android 4.1.1". Interval (eg, the size of the screen is: 3.0 to 5.3 inches, 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 webpage file may include: an HTML file, a CSS file, a JS (JavaScript) file, a picture, etc. Wait. Web pages are generally rendered based on the various web page files described above. In addition, the webpage file may also be referred to as a webpage resource, and the webpage resource may include a static resource and a dynamic resource.
本申请实施例中,在上述步骤S103之前,所述方法还包括如下步骤:In the embodiment of the present application, before the step S103, the method further includes the following steps:
a)所述服务器根据所述设备信息,确定与所述设备信息对应的网页文件的文件标识,其中,所述文件标识可以例如是网页文件的URL(Uniform Resource Locator,统一资源定位符)或者文件名,所述URL例如: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 (Uniform Resource Locator) or a file of a webpage 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/z12E0/hash/8q2anwu7.gif"
“HTTP://static.ak.fbcdn.net/rsrc.php/zBS5C/hash/7hwy7at6.gif”"HTTP://static.ak.fbcdn.net/rsrc.php/zBS5C/hash/7hwy7at6.gif"
*CSS文件:*CSS file:
“HTTP://static.ak.fbcdn.net/rsrc.php/z448Z/hash/2plh8s4n.css”"HTTP://static.ak.fbcdn.net/rsrc.php/z448Z/hash/2plh8s4n.css"
“HTTP://static.ak.fbcdn.net/rsrc.php/zANE1/hash/cvtutcee.css”"HTTP://static.ak.fbcdn.net/rsrc.php/zANE1/hash/cvtutcee.css"
*JS文件:*JS file:
“HTTP://static.ak.fbcdn.net/rsrc.php/zEMOA/hash/c8yzb6ub.js”"HTTP://static.ak.fbcdn.net/rsrc.php/zEMOA/hash/c8yzb6ub.js"
“HTTP://static.ak.fbcdn.net/rsrc.php/z6R9L/hash/cq2lgbs8.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 a file (ie, an HTML file) containing the file identifier to the terminal.
一般地,服务器(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) needs to return a corresponding HTTP response (HTTP Response) to the terminal in response to the webpage request (HTTP request) sent by the terminal. The HTTP response (ie, the above HTML file) may include: protocol status version code description information, Response Header information, and response body. The returned HTML response may include the file identifier determined above, 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 client needs to adopt in the subsequent webpage rendering process. According to the above example, if the screen resolution of the current terminal 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's screen resolution is 800px*1280px, the CSS file to be used in the rendering process should be "800.css", the HTML returned by the server. The file 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 file identifiers of the remaining webpage files that need not be loaded. . According to the above example, in the prior art, whether the screen resolution of the terminal is "400px*800px" or "800px*1280px", the above CSS file needs to be returned to the terminal: "400.css" and "800.css For a terminal with a screen 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 application can specifically return a webpage file corresponding to the device information to the terminal according to different screen resolutions (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 a 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 and pictures) embedded in the current webpage style by sending a corresponding file acquisition request to the server. The file acquisition request carries the URL of the webpage 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 application, the server may determine the 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 client) sends the HTTP request to the server, it may not need to send to the server to obtain each A file acquisition request for a web page file.
步骤S104:终端接收与设备信息对应的网页文件,并利用接收到的网页文件进行网页的渲染,以将相应的网页样式显示于所述终端的屏幕上。由于网页渲染过程属于本领域所习知的技术,本文不再予以详述。Step S104: The terminal receives the webpage file corresponding to the device information, and performs rendering of the webpage by 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 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 based on a server according to an embodiment of the present application. Referring to the embodiment described in FIG. 1 above, in an embodiment of the present application, 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 application, the foregoing method for sending a webpage file further includes:
步骤S203:判断是否查找到与用户代理信息对应的设备信息。若查找到,则进入步骤S204;若没有查找到,则进入下述步骤S205。Step S203: It is determined 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 to the web page style that matches the device information. 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 selects the webpage file to be loaded from the basic resource package, and finally uses 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 client) can dynamically collect the device information of the current terminal through a certain method (such as JavaScript) while performing webpage rendering, such as: resolution information of the screen, pixel density of the screen. Information, screen size information, operating system information used, hardware platform information, and more.
步骤S207:服务器生成返回的设备信息和用户代理信息的映射关系并存储。Step S207: The server generates a mapping relationship between the returned device information and the user agent information and stores it.
终端可向服务器发送一携带上述设备信息和用户代理信息的请求命令,以使得服务器将采集到设备信息和用户代理信息形成一定的映射关系,并存储到数据库中。通过以上步骤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 data in the database. Through the above steps S205-S207, when the device information corresponding to the user agent information is not queried, the data in the current database (the correspondence between the user agent information and the device information) may be supplemented by the manner of the terminal collection. Perfect, thus achieving the "self-learning process" of the database. Through the above-mentioned "self-learning process", in the process of the server subsequently querying the database, 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, thereby making the server The execution efficiency can be continuously improved.
上述图3所介绍的实施例是从服务器的角度说明了本申请的技术方案,实际上,本申请还可以从终端的角度进行实施,并同样能够解决上述问题。参照上述图1所介绍的实施例,在本申请一实施例提供的一种网页渲染方法,包括如下步骤:The embodiment described in FIG. 3 above illustrates the technical solution of the present application from the perspective of a server. In fact, the present application 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 provided by an embodiment of the present application 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 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 determining, according to the device information, various webpage files corresponding to the device and sending the webpage file to the terminal, so that the terminal performs rendering of the webpage by using the webpage file corresponding to the device information. 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. The webpage file required by the webpage rendering process, and avoiding returning other webpage files that do not need to be loaded to the above terminal, can reduce the consumption of network resources to a certain extent.
另一方面,在现有技术中,由于终端(浏览器或客户端)一般需要采集到自身的设备信息,并利用媒体查询(Media Query)方法,来确定与当前设备信息所对应的网页样式及该网页样式所需加载的各种网页文件,并从服务器返回的网页文件中,选取所需加载的各种网页文件。可以看出,现有技术中除了存在增加了额外的、冗余的资源下载成本(即额外消耗网络资源),造成加载性能不佳的问题之外,还存在如下问题:终端在进行网页渲染之前,需要确定自身的设备信息,还需要利用媒体查询方法判断所需加载的网页文件,并从服务器返回的网页文件中选取所需加载的网页文件,一定程度上,终端执行上述步骤的过程均需要消耗自身的处理资源。也就是说,在网页渲染的过程中,终端还需要考虑该以何种网页样式进行渲染,需要应用到哪些网页条件,这势必会影响到浏览器或客户端渲染网页的性能,降低网页响应的速度。可见,通过本申请实施例提供的上述方法,在网页渲染之前,确定终端的设备信息并确定与设备信息对应的网页文件均是由服务器来执行的,避免了由终端执行上述过程,从而避免因终端执行上述步骤而过多消耗终端的处理资源的问题,进而提升终端渲染网页的性能,提升网页响应的速度。On the other hand, in the prior art, since the terminal (browser or client) generally needs to collect its own device information, and uses a Media Query method to determine the webpage 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 is added (that is, the network resource is additionally consumed), resulting in poor loading performance, the following problems exist in the prior art: before the terminal performs webpage rendering It is necessary to determine the device information of the device, and also need to use the media query method to determine the webpage file to be loaded, and select the webpage file to be loaded from the webpage file returned by the server. To some extent, the terminal needs to perform the above steps. Consume processing resources of its own. That is to say, in the process of rendering the webpage, the terminal also needs to consider which webpage style is to be rendered, and which webpage conditions need to be applied, which will inevitably affect the performance of the webpage rendered by the browser or the client, and reduce the response of the webpage. speed. It can be seen that, by using the foregoing method provided by the embodiment of the present application, before the webpage is rendered, determining the device information of the terminal and determining that the webpage file corresponding to the device information is performed by the server, avoiding performing the foregoing process by the terminal, thereby avoiding The terminal performs the above steps to excessively consume the processing resources of the terminal, 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 subject of step S201 and step S202 may be device 1, and the execution subject of step S203 may be device 2; for example, the execution subject of step S201 may be device 1, and the execution subject 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 application. Reference map As shown in FIG. 4, in an embodiment of the present application, the terminal 100 includes a browser or client 101, a webpage rendering apparatus 110, and the server 200 includes a webpage file transmitting apparatus 210, wherein the webpage rendering apparatus 110 and the webpage file transmitting apparatus 210 are The terminal 100 and the server 200 may be present in software, hardware, or a combination of hardware and software, respectively. The server 200 and the terminal 100 described above 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 nonvolatile memory, a bus, an input/output device, and the like. In addition to the above hardware, the above terminal 100 and server 200 also 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 implemented by referring to the webpage rendering method. The content of the example will not be repeated here. 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 application, 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, according to the user agent information, that the user agent information is corresponding to the user agent information. The device information of the terminal; 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 may search for the device information corresponding to the user agent information by searching the first database 300. The first database 300 may pre-store the mapping relationship between the user agent information and the device information. In addition, the foregoing obtaining unit 215 may acquire various webpage files by sending a request to the second database 400, and the sent request may be HTTP header information carrying the device information. The foregoing second database 400 can be stored in various webpage files (resources), such as: HTML files, CSS files, pictures, 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 sending device, the embodiment of the present application 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. The webpage file required by the webpage rendering process, and avoiding returning other webpage files that do not need to be loaded to the above terminal, can reduce the consumption of network resources to a certain extent. In addition, the foregoing method provided by the embodiment of the present application determines the device information of the terminal and determines that the webpage file corresponding to the device information is executed by the server before the rendering of the webpage, thereby avoiding performing the foregoing process by the terminal, thereby avoiding The terminal performs the above steps However, the problem of processing resources of the terminal is excessively consumed, thereby improving the performance of the terminal rendering webpage and improving the response speed of the webpage.
本申请可选的实施例中,所述网页文件发送装置210还包括:In an optional embodiment of the present application, the webpage file sending apparatus 210 further includes:
生成单元,预先生成用户代理信息和设备信息的映射关系;Generating a unit to generate a mapping relationship between user agent information and device information in advance;
则,所述确定单元213根据预先生成的用户代理信息和设备信息的映射关系,查找与所述用户代理信息相映射的所述终端的设备信息;Then, the determining unit 213 searches 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 that are generated in advance;
在另一实施例中,所述网页文件发送装置210还包括:In another embodiment, the webpage file sending apparatus 210 further includes:
生成单元,预先生成设备信息和特征信息的映射关系;其中,所述特征信息是所述用户代理信息中包含的;a generating unit, configured to generate a mapping relationship between the device information and the feature information in advance; wherein the feature information is included in the user agent information;
则,所述确定单元213包括:信息提取单元和信息查询单元;所述信息提取单元提取所述用户代理信息中包含的特征信息;所述信息查询单元根据预先生成的设备信息和特征信息的映射关系,确定与所述特征信息对应的所述终端的设备信息。Then, 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 mapping of the information query unit according to the device information and the feature information generated in advance And 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 application, 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 according to the user agent The information is determined; the rendering unit 115 performs rendering of the webpage by using a webpage file corresponding to the device information.
本申请可选的实施例中,上述网页渲染装置110还包括:In an optional embodiment of the present application, the webpage rendering apparatus 110 further includes:
文件接收单元,接收所述服务器返回的文件;所述文件包含与终端的设备信息对应的网页文件的文件标识;a file receiving unit, configured to receive a file returned by the server; the file includes a file identifier of a webpage file corresponding to device information of the terminal;
请求发送单元,向所述服务器发送携带所述文件标识的获取请求;Sending a request, sending an acquisition request carrying the file identifier to the server;
所述接收单元113接收所述服务器响应于所述获取请求返回的与所述终端的设备信息对应的网页文件。The receiving unit 113 receives a webpage file corresponding to the device information of the terminal returned by the server in response to the obtaining request.
利用上述网页渲染装置,本申请实施例可以至少达到如下技术效果:With the above webpage rendering device, the embodiment of the present application 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. The webpage file required by the webpage rendering process, and avoiding returning other webpage files that do not need to be loaded to the above terminal, can reduce the consumption of network resources to a certain extent. In addition, the foregoing method provided by the embodiment of the present application determines the device information of the terminal and determines the webpage text corresponding to the device information before the webpage is rendered. The device is executed by the server, which avoids the above-mentioned process performed 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.
继续参照图4,本申请实施例中,一种网页渲染系统,包括:服务器200、第一数据库300和第二数据库400,所述第一数据库300存储有用户代理信息与设备信息的映射关系,所述第二数据库400存储有与设备信息对应的网页文件,所述服务器200接收终端100发送的携带用户代理信息的网页请求,并从所述第一数据库300中查询与所述网页请求中携带的用户代理信息对应的设备信息,所述服务器200从所述第二数据库400获取与所述设备信息对应的网页文件,并将获取的所述网页文件发送至终端100。With reference to FIG. 4, in the embodiment of the present application, a webpage rendering system includes: a server 200, a first database 300, and a second database 400. The first database 300 stores a mapping relationship between 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 carries the user agent information sent by the terminal 100, and queries from the first database 300 to carry with the webpage request. The server 200 obtains the webpage file corresponding to the device information from the second database 400, and sends the obtained webpage file to the 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 application, the foregoing system may further include: a Web API (Application Programming Interface) and a TFS (Team Foundation Server) interface, the Web API and the TFS interface. Both are based on the two interfaces of the server 200 and the first database 300 for providing services to the upper layer service, and the above Web API and the TFS interface may be used to return different results (such as HTML and pictures) from the second database 400. Etc.) is packaged into a corresponding API (such as Ajax), so that various upper-layer services can call the above API, 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 each unit may be implemented in the same software or software and/or hardware when implementing the present application.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、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. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方 式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions can also be stored in a particular computer capable of booting a computer or other programmable data processing device In a computer readable memory that operates in a computer readable memory, causing instructions stored in the computer readable memory to produce an article of manufacture comprising instruction means implemented in a block or in a flow or a flow diagram and/or block diagram of the flowchart The functions specified in the boxes.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。It is also to be understood that the terms "comprises" or "comprising" or "comprising" or any other variations are 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 application can be provided as a method, system, or computer program product. Thus, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment in combination of software and hardware. Moreover, the application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
本申请可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本申请,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。The application can be described in the general context of computer-executable instructions executed by a computer, such as a program module. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform particular tasks or implement particular abstract data types. The present application can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are connected through a communication network. In a distributed computing environment, program modules can be located in both 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 application and is not intended to limit the application. Various changes and modifications can be made to the present application by those skilled in the art. Any modifications, equivalents, improvements, etc. made within the spirit and scope of the present application are intended to be included within the scope of the appended claims.

Claims (15)

  1. 一种网页文件发送方法,其特征在于,包括:A webpage file sending method, comprising:
    服务器接收终端发送的携带与所述终端对应的用户代理信息的网页请求;The server receives a webpage request sent by the terminal and carries user agent information corresponding to the terminal;
    所述服务器根据所述用户代理信息,确定与所述用户代理信息对应的所述终端的设备信息;Determining, by the server, 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 webpage file to the terminal.
  2. 根据权利要求1所述的方法,其特征在于,所述服务器获取与所述设备信息对应的网页文件并向所述终端发送之前,所述方法还包括:The method according to claim 1, wherein before the server obtains a webpage file corresponding to the device information and sends the webpage file to the terminal, the method further includes:
    所述服务器根据所述设备信息,确定与所述设备信息对应的网页文件的文件标识;Determining, by the server, a file identifier of a webpage file corresponding to the device information according to the device information;
    所述服务器向所述终端发送包含所述文件标识的文件;Sending, by the server, a file that includes the file identifier to the terminal;
    所述服务器获取与所述设备信息对应的网页文件并向所述终端发送,具体包括:The server obtains a webpage file corresponding to the device information, and sends the webpage file to the terminal, which specifically includes:
    所述服务器接收所述终端发送的携带所述文件标识的文件获取请求;Receiving, by the server, a file obtaining request that is sent by the terminal and carrying the file identifier;
    所述服务器响应于所述文件获取请求,获取与所述设备信息对应的网页文件并向所述终端发送。The server acquires a webpage file corresponding to the device information and sends the webpage file to the terminal in response to the file acquisition request.
  3. 根据权利要求1所述的方法,其特征在于,所述服务器根据所述用户代理信息,确定与所述用户代理信息对应的所述终端的设备信息之前,所述方法还包括:The method according to claim 1, wherein the method further includes: before the determining, by the server, the 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;
    所述服务器根据所述用户代理信息,确定与所述用户代理信息对应的所述终端的设备信息,具体包括:Determining, by the server, the device information of the terminal corresponding to the user agent information according to the user agent information, specifically:
    所述服务器根据预先生成的用户代理信息和设备信息的映射关系,查找与所述用户代理信息相映射的所述终端的设备信息;The server searches for device information of the terminal that is mapped with the user agent information according to a mapping relationship between user agent information and device information generated in advance;
    或,or,
    所述服务器根据所述用户代理信息,确定与所述用户代理信息对应的所述终端的设备信息之前,所述方法还包括:Before the determining, by the server, the device information of the terminal that is corresponding to the user agent information, the method further includes:
    所述服务器将设备信息和特征信息的映射关系进行存储;所述特征信息是所述用户代理信息中包含的;The server stores a mapping relationship between the device information and the feature information; the feature information is included in the user agent information;
    所述服务器根据所述用户代理信息,确定与所述用户代理信息对应的所述终端的设备信息,具体包括:Determining, by the server, the device information of the terminal corresponding to the user agent information according to the user agent information, specifically:
    所述服务器提取所述用户代理信息中包含的特征信息;The server extracts feature information included in the user agent information;
    所述服务器根据存储的设备信息和特征信息的映射关系,查询与所述特征信息对应 的所述终端的设备信息。The server queries the corresponding feature information according to the mapping relationship between the stored device information and the feature information. Device information of the terminal.
  4. 根据权利要求3所述的方法,其特征在于,所述服务器根据预先生成的用户代理信息和设备信息的映射关系,查找与所述用户代理信息相映射的所述终端的设备信息之后,所述方法还包括:The method according to claim 3, wherein the server searches for device information of the terminal mapped with the user agent information according to a mapping relationship between user agent information and device information generated in advance, The method also 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 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 stores the mapping relationship.
  5. 根据权利要求1~4中任意一项所述的方法,其特征在于,所述设备信息包括显示器信息。The method according to any one of claims 1 to 4, wherein the device information comprises display information.
  6. 根据权利要求5所述的方法,其特征在于,所述显示器信息包括分辨率信息或像素密度信息或屏幕尺寸信息。The method of claim 5 wherein said display information comprises resolution information or pixel density information or screen size information.
  7. 一种网页渲染方法,其特征在于,包括:A webpage rendering method, comprising:
    终端向服务器发送携带与所述终端对应的用户代理信息的网页请求;Sending, by the terminal, a webpage request that carries user agent information corresponding to the terminal to the server;
    所述终端接收所述服务器返回的与所述终端的设备信息对应的网页文件;所述终端接收的网页文件是由所述服务器根据所述设备信息获取到的,所述设备信息是所述服务器根据所述用户代理信息确定的;Receiving, by the terminal, a 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, and the device information is the server Determined according to the user agent information;
    所述终端利用与所述设备信息对应的网页文件进行网页的渲染。The terminal performs rendering of the webpage by using a webpage file corresponding to the device information.
  8. 根据权利要求7所述的方法,其特征在于,所述终端接收所述服务器返回的与所述终端的设备信息对应的网页文件之前,所述方法还包括:The method according to claim 7, wherein the method further comprises: before the terminal receives the webpage file corresponding to the device information of the terminal that is returned by the server, the method further includes:
    所述终端接收所述服务器返回的文件;所述文件包含与所述终端的设备信息对应的网页文件的文件标识;Receiving, by the terminal, a file returned by the server; the file includes a file identifier of a webpage file corresponding to device information of the terminal;
    所述终端向所述服务器发送携带所述文件标识的获取请求;Sending, by the terminal, an acquisition request that carries the file identifier to the server;
    所述终端接收所述服务器返回的与所述终端的设备信息对应的网页文件,具体包括:Receiving, by the terminal, a webpage file that is returned by the server and corresponding to the device information of the terminal, specifically:
    所述终端接收所述服务器响应于所述获取请求返回的与所述终端的设备信息对应的网页文件。The terminal receives a webpage file corresponding to the device information of the terminal returned by the server in response to the obtaining request.
  9. 根据权利要求7所述的方法,其特征在于,所述方法还包括:The method of claim 7, 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 basic resource package corresponding to the webpage request by the server;
    所述终端利用所述基本资源包进行网页加载,并采集与所述终端对应的设备信息和用户代理信息;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 user agent information corresponding to the device information to the server.
  10. 根据权利要求7~9中任意一项所述的方法,其特征在于,所述设备信息包括显示器信息。The method according to any one of claims 7 to 9, wherein the device information comprises display information.
  11. 一种网页文件发送装置,其特征在于,包括:接收单元,确定单元,获取单元及发送单元;所述接收单元接收终端发送的携带与所述终端对应的用户代理信息的网页请求;所述确定单元根据所述用户代理信息,确定与所述用户代理信息对应的所述终端的设备信息;所述获取单元获取与所述设备信息对应的网页文件;所述发送单元向所述终端发送与所述设备信息对应的网页文件。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 Determining device information of the terminal corresponding to the user agent information according to the user agent information; the acquiring unit acquires a webpage file corresponding to the device information; and the sending unit sends the device to the terminal The web page file corresponding to the device information.
  12. 根据权利要求11所述的装置,其特征在于,所述装置还包括:The device according to claim 11, wherein the device further comprises:
    存储单元,将用户代理信息和设备信息的映射关系进行存储;a storage unit that stores a mapping relationship between user agent information and device information;
    则所述确定单元根据存储的用户代理信息和设备信息的映射关系,查找与所述用户代理信息相映射的所述终端的设备信息;And the determining unit searches for device information of the terminal that is mapped with the user agent information according to the mapping relationship between the stored user agent information and the device information;
    或,or,
    所述装置还包括:The device also includes:
    存储单元,将设备信息和特征信息的映射关系进行存储;所述特征信息是所述用户代理信息中包含的;a storage unit, where the mapping relationship between the device information and the feature information is stored; the feature information is included in the user agent information;
    则所述确定单元包括:信息提取单元和信息查询单元;The determining unit includes: an information extracting unit and an information query unit;
    所述信息提取单元提取所述用户代理信息中包含的特征信息;The information extracting unit extracts feature information included in the user agent information;
    所述信息查询单元根据存储的设备信息和特征信息的映射关系,查询与所述特征信息对应的所述终端的设备信息。The information querying 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.
  13. 一种网页渲染装置,其特征在于,包括:发送单元,接收单元和渲染单元;所述发送单元向服务器发送携带与终端对应的用户代理信息的网页请求;所述接收单元接收所述服务器返回的与所述终端的设备信息对应的网页文件;所述终端接收的网页文件是由所述服务器根据所述设备信息获取到的,所述设备信息是所述服务器根据所述用户代理信息确定的;所述渲染单元利用与所述设备信息对应的网页文件进行网页的渲染。A webpage rendering apparatus, comprising: 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; the receiving unit receives the return of the server a 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 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.
  14. 根据权利要求13所述的装置,其特征在于,所述装置还包括:The device according to claim 13, wherein the device further comprises:
    文件接收单元,接收所述服务器返回的文件;所述文件包含与终端的设备信息对应 的网页文件的文件标识;a file receiving unit, which receives a file returned by the server; the file includes a device information corresponding to the terminal File identifier of the web page file;
    请求发送单元,向所述服务器发送携带所述文件标识的获取请求;Sending a request, sending 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 obtaining request.
  15. 一种网页渲染系统,其特征在于,包括服务器、第一数据库和第二数据库,所述第一数据库存储有用户代理信息与设备信息的映射关系,所述第二数据库存储有与设备信息对应的网页文件,所述服务器接收终端发送的携带用户代理信息的网页请求,并从所述第一数据库中查询与所述网页请求中携带的用户代理信息对应的设备信息,所述服务器从所述第二数据库获取与所述设备信息对应的网页文件,并将获取的所述网页文件发送至终端。 A webpage rendering system, comprising: 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 receives a webpage request that is sent by the terminal and carries the user agent information, and queries, from the first database, device information corresponding to the user agent information carried in the webpage request, the server from the first The second database acquires a webpage file corresponding to the device information, and sends the obtained webpage file to the terminal.
PCT/CN2017/088637 2016-06-28 2017-06-16 Webpage file sending method, webpage rendering method and apparatus, and webpage rendering system WO2018001124A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610488238.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 (1)

Publication Number Publication Date
WO2018001124A1 true WO2018001124A1 (en) 2018-01-04

Family

ID=59190561

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/088637 WO2018001124A1 (en) 2016-06-28 2017-06-16 Webpage file sending method, webpage rendering method and apparatus, and webpage rendering system

Country Status (3)

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

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109831493A (en) * 2019-01-18 2019-05-31 深圳壹账通智能科技有限公司 A kind of detection method of image configurations, device, equipment and medium
CN111414562A (en) * 2020-02-26 2020-07-14 平安普惠企业管理有限公司 Application program page API interface preposition method and device and storage medium
CN112632941A (en) * 2019-09-23 2021-04-09 北京国双科技有限公司 Method, device, equipment and storage medium for generating PDF format public security document
CN113467776A (en) * 2021-06-28 2021-10-01 青岛海尔科技有限公司 Access method and device of equipment, storage medium and electronic device

Families Citing this family (7)

* 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
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
CN112883298B (en) * 2019-11-29 2024-03-01 阿里巴巴集团控股有限公司 Information processing method, device, electronic equipment and storage medium

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
CN101150803A (en) * 2007-10-24 2008-03-26 优视动景(北京)技术服务有限公司 Method for micro-browser to process network data, micro-browser and its server
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
CN1996989B (en) * 2006-01-01 2010-06-23 腾讯科技(深圳)有限公司 A personal page system and its realization method
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
CN101067819A (en) * 2007-06-07 2007-11-07 北京大学 Web page resource issuing method and issuing system
CN101150803A (en) * 2007-10-24 2008-03-26 优视动景(北京)技术服务有限公司 Method for micro-browser to process network data, micro-browser and its server
CN104462131A (en) * 2013-09-23 2015-03-25 阿里巴巴集团控股有限公司 Method and device for processing information issuing page

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109831493A (en) * 2019-01-18 2019-05-31 深圳壹账通智能科技有限公司 A kind of detection method of image configurations, device, equipment and medium
CN112632941A (en) * 2019-09-23 2021-04-09 北京国双科技有限公司 Method, device, equipment and storage medium for generating PDF format public security document
CN111414562A (en) * 2020-02-26 2020-07-14 平安普惠企业管理有限公司 Application program page API interface preposition method and device and storage medium
CN111414562B (en) * 2020-02-26 2023-08-29 深圳运动帝图科技有限公司 Application program page API interface preposition method, device and storage medium
CN113467776A (en) * 2021-06-28 2021-10-01 青岛海尔科技有限公司 Access method and device of equipment, storage medium and electronic device
CN113467776B (en) * 2021-06-28 2023-06-13 青岛海尔科技有限公司 Method and device for accessing equipment, storage medium and electronic device

Also Published As

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

Similar Documents

Publication Publication Date Title
WO2018001124A1 (en) Webpage file sending method, webpage rendering method and apparatus, and webpage rendering system
US8527862B2 (en) Methods for making ajax web applications bookmarkable and crawlable and devices thereof
US10346502B2 (en) Mobile enablement of existing web sites
JP2019032883A (en) Method, apparatus, server and system for implementing web application
US20140201617A1 (en) Method for Browsing Web Page on Mobile Terminal
WO2015154666A1 (en) Method for displaying webpage fragment on desktop and system for capturing webpage fragment to desktop for display
CN108416021B (en) Browser webpage content processing method and device, electronic equipment and readable medium
WO2015074459A1 (en) Method and apparatus for opening webpage, invoking client, and creating light app
CN110221871B (en) Webpage acquisition method and device, computer equipment and storage medium
CN112417243A (en) Search results for native applications
WO2016050124A1 (en) Method, device and server for web page transcoding
JP5112401B2 (en) Web action history acquisition system, Web action history acquisition method, gateway device, and program
JP2016540333A (en) Terminal marking method, terminal marking device, program, and recording medium
JP5604016B1 (en) Script caching method and information processing apparatus using the same
US20130290515A1 (en) Method and Apparatus for Redirecting Webpage Requests to Appropriate Equivalents
WO2015058614A1 (en) Bookmark storage method and device, and method and device for determining bookmark to be browsed
WO2015154270A1 (en) Method and device for information search
US9854053B1 (en) Providing faster data access using multiple caching servers
JP4903118B2 (en) WEB server and program for collecting sensing data
CN103561068A (en) Method and device for improving speed of web page browsing
CN103793459B (en) Webpage opening method and device
JP5809099B2 (en) Web browsing screen thumbnail generation system
US8332469B1 (en) Web resource caching
JP5774429B2 (en) COMMUNICATION DEVICE, COMMUNICATION METHOD, AND PROGRAM
JP6378601B2 (en) Content analysis apparatus, content analysis method, and program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17819121

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17819121

Country of ref document: EP

Kind code of ref document: A1