WO2015161658A1 - Webpage resource loading method and device - Google Patents

Webpage resource loading method and device Download PDF

Info

Publication number
WO2015161658A1
WO2015161658A1 PCT/CN2014/093700 CN2014093700W WO2015161658A1 WO 2015161658 A1 WO2015161658 A1 WO 2015161658A1 CN 2014093700 W CN2014093700 W CN 2014093700W WO 2015161658 A1 WO2015161658 A1 WO 2015161658A1
Authority
WO
WIPO (PCT)
Prior art keywords
webpage
webpage resource
identifier
resource
original
Prior art date
Application number
PCT/CN2014/093700
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 WO2015161658A1 publication Critical patent/WO2015161658A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Definitions

  • the present invention relates to the field of mobile communication technologies, and in particular, to a webpage resource loading method and apparatus.
  • a web page is composed of an html file and a css style file, a js style file, a picture, and the like.
  • the html file is a main resource, and other files are sub-resources.
  • the mobile terminal browser When the mobile terminal browser is used to browse a certain webpage for the first time, the webpage file needs to be all loaded onto the mobile terminal from the server through the network for display. After the first browsing, part of the content of the webpage can be cached on the mobile terminal.
  • the mobile terminal browser sets the html file as a non-cacheable file, and the cacheable files are css style files, js style files, and picture files.
  • you browse the page again you can only load the resources of the uncached html file part, which can increase the loading speed and save some traffic.
  • the average size of an html file in a web page is 37.55 KB, which is 12% of the page size. Therefore, although the html file is only reloaded when browsing the web page again, the loading takes a long time and the data traffic consumed is very large.
  • the embodiment of the present invention provides a method and a device for loading a webpage resource, which can prevent the webpage from being repeatedly loaded when the webpage of the mobile terminal browses the webpage again, which can not only shorten the loading time but also save traffic.
  • an embodiment of the present invention provides a method for loading a webpage resource, where the method includes: receiving request information sent by a client, where the request information includes a webpage address corresponding to the webpage resource and an original identifier corresponding to the webpage resource.
  • the middleware server obtains the webpage resource corresponding to the webpage address, and determines the identifier of the latest version corresponding to the webpage address; when the original identifier is different from the identifier of the latest version, the original webpage corresponding to the original identifier is calculated.
  • a second aspect a method for loading a webpage resource, comprising: sending request information to a middleware server, where the request information includes a webpage address corresponding to the webpage resource and an original identifier corresponding to the webpage resource; and receiving the return of the middleware server The identifier of the latest version corresponding to the webpage resource, and the difference data of the original webpage resource and the new webpage resource; generating the new webpage resource by using the difference data and the original webpage resource for loading.
  • the embodiment of the present invention further provides a webpage resource loading device and a storage medium and a program, which are respectively corresponding to the first aspect, the second aspect, and the third aspect.
  • the method and device for loading a webpage resource provided by the embodiment of the present invention, when the middleware server receives the request information of the webpage address and the original identifier corresponding to the webpage resource sent by the client, determining the webpage The ID of the latest version corresponding to the address.
  • the new webpage resource corresponding to the latest version of the identifier is updated compared to the original webpage resource, and the difference between the original webpage resource and the new webpage resource is calculated.
  • Data the difference data is sent to the client.
  • the difference data and the original webpage resource are used to generate, by the client, the new webpage resource according to the preset rule.
  • the webpage resources requested by the client are updated, only the difference data of the updated part is loaded, which not only shortens the loading time but also saves traffic.
  • FIG. 1 is a flowchart of a method for loading a first method of webpage resource loading according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a method for loading a webpage resource according to a second embodiment of the present invention
  • FIG. 3 is a flowchart of a method for loading a webpage resource according to a third embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of a first embodiment of a webpage resource loading apparatus according to an embodiment of the present disclosure
  • FIG. 5 is a schematic structural diagram of a second implementation manner of a webpage resource loading apparatus according to an embodiment of the present disclosure
  • FIG. 6 is a schematic structural diagram of a third embodiment of a webpage resource loading apparatus according to an embodiment of the present invention.
  • the present invention introduces a middleware server, which is a proxy server of a client, and puts a modification of a client and a server into the middleware server, so that the technical solution of the present invention Has good compatibility.
  • FIG. 1 is a flowchart of a method for loading a webpage resource according to a first embodiment of the present invention. The method includes:
  • Step S101 Receive request information sent by the client.
  • the request information When the client requests to access the A webpage for the first time, the request information includes the webpage address of the A webpage, and the middleware server obtains the webpage resource of the A webpage according to the webpage address; when the client is Nth (N is greater than or equal to 2)
  • the request information includes not only the webpage address of the webpage of A, but also the identifier corresponding to the webpage resource when the webpage was last visited.
  • the webpage address corresponding to the A webpage in the middleware server can store multiple versions of webpage resources, and each version of the webpage resource corresponds to one identifier.
  • the identifier included in the request information is used as the original identifier, and the original identifier corresponds to the original identifier.
  • the web resource is used as the original web resource.
  • the embodiment of the present invention can satisfy various application scenarios, and the client can be an intelligent mobile terminal, an IPAD, a computer, etc.; the middleware server can be set in a network that establishes a communication connection with the client.
  • Step S102 Determine an identifier of the latest version corresponding to the webpage resource.
  • the webpage resource of the A webpage is continuously updated, and each updated version generates an identifier uniquely corresponding to the webpage resource of the version.
  • the middleware server may store multiple updated versions of the webpage A. Web resources, each updated version corresponds to an identifier.
  • the webpage resources of the A webpage may not have an updated version at this time, and the original webpage resource is the current latest version of the webpage resource.
  • the identifier of the latest version refers to the identifier corresponding to the current latest version of the webpage resource.
  • the latest version of the identifier may be determined from all the identifiers read by reading all the identifiers corresponding to the webpage address of the A webpage in the middleware server. It can be seen that the setting of the logo can be clearly cleared. Chu indicates whether there is an update of the webpage resource, and it is more convenient and quick to find the webpage resources of different versions by looking up the identifier.
  • Step S103 When the original identifier is different from the identifier of the latest version, calculate difference data of the new webpage resource corresponding to the original webpage resource corresponding to the original identifier and the latest webpage resource according to the preset rule.
  • the new webpage resource corresponding to the identifier of the latest version is different from the original webpage resource content corresponding to the original identifier, that is, the new webpage resource is The current version of the webpage resource, and then calculating the difference data between the new webpage resource and the original webpage resource according to a preset rule or algorithm, thereby accurately and conveniently obtaining the updated part of the webpage resource and the updated content.
  • the original identifier by comparing the original identifier with the new identifier, it is determined whether the webpage resource is updated. Compared with directly comparing the webpage resources, the compared content is greatly reduced, which makes the comparison process more convenient and quick, and the operation process is simpler.
  • Step S104 Send the difference data to the client.
  • the client only the difference data including the updated part and the updated content is sent to the client, and the client obtains the new webpage resource on the basis of the original webpage resource by using the same preset rule or algorithm as the difference data.
  • the client obtains the new webpage resource on the basis of the original webpage resource by using the same preset rule or algorithm as the difference data.
  • the middleware server when the middleware server sends the difference data to the client, the latest version identifier corresponding to the new webpage resource may be sent to the client.
  • the latest version of the identifier is used to mark the new webpage. Resources.
  • the latest version of the identifier is sent to the middleware server as the original identifier.
  • the webpage resource loading method determines the webpage address when the middleware server receives the request information of the webpage address and the original identifier corresponding to the original webpage resource sent by the client. Corresponding to the latest version of the logo.
  • the new webpage resource corresponding to the latest version of the identifier is updated compared to the original webpage resource, and the difference between the original webpage resource and the new webpage resource is calculated.
  • Data the difference data is sent to the client.
  • the difference data and the original webpage resource are used to generate, by the client, the new webpage resource according to the preset rule.
  • the webpage resources requested by the client are updated, only the difference data of the updated part is loaded, which not only shortens the loading time but also saves traffic.
  • FIG. 2 is a flowchart of a method for loading a webpage resource according to a second embodiment of the present invention, where the method includes:
  • Step S201 Receive request information sent by the client.
  • the middleware server searches whether the webpage resource corresponding to the webpage address is stored according to the webpage address of the webpage included in the request information, and if the webpage resource is valid, The webpage resource and its corresponding identifier are sent to the client, and details about whether the webpage resource is valid are described in the following description of the embodiment.
  • the client saves the webpage resource and its corresponding identifier.
  • the webpage address and the stored identifier are sent to the middleware server, when the webpage resource has a new version of the webpage resource with the updated version.
  • the received identifier is used as the original identifier to search for the corresponding original webpage resource, and the difference data between the original webpage resource and the new webpage resource is calculated.
  • the identifiers in the embodiments of the present invention are generated by using a hash algorithm or other computer algorithms according to the content of the webpage resources. Therefore, different webpage resources correspond to unique identifiers.
  • the generation of the identification by a hash algorithm or other computer algorithm is a technique well known to those skilled in the art, and the present invention will not be described herein.
  • Step S202 It is determined whether a valid webpage resource corresponding to the webpage address is stored; when it is stored, step S203 is performed; otherwise, step S211 is performed.
  • the middleware server in order to improve the utilization rate of the middleware server, can establish a connection with multiple clients, so that the middleware server can store webpage resources of a plurality of different webpages, and each webpage corresponds to multiple different versions. Web resources. Due to the limited storage space of the middleware server and the different update speeds of some web pages, for example, the update frequency of Sina Weibo is very high, and the update frequency of the NetEase portal website is relatively low. Therefore, the webpage resources stored in the middleware server are all set to have an expiration date. In the present application, the webpage resource in the validity period is called a valid webpage resource, and when the expiration date is exceeded, the webpage resource is considered to be in an invalid state, and is called an invalid webpage resource.
  • the middleware server clears the webpage resource, and not only can reasonably utilize the storage space of the middleware server, but also can timely update the webpage resource in the middleware server.
  • the webpage resources corresponding to the same webpage address have the same validity period.
  • the validity period of the webpage resource can be set by the duration, and the effective duration of the webpage resources of different webpages can be set differently.
  • the effective duration of the webpage can be set to one week, and the effective duration of the microblogging website can be set to ten minutes.
  • the preset time to clear after the web resource is invalid can also be set by itself.
  • Duration setting The invention can be set according to the update frequency of the webpage and the number of times of browsing, and the present invention does not limit this.
  • the middleware server After receiving the request information of the A webpage, the middleware server searches whether the webpage resource is stored according to the webpage address, and when the webpage resource is stored, determines whether the stored webpage resource is valid, and takes different measures according to different states of the webpage resource. .
  • Step S203 Find all the identifiers corresponding to the webpage address.
  • the middleware server When the webpage resource stored in the middleware server is valid, all the updated versions of the A webpage to the current reading are determined. As can be seen from the above description, many webpage resources are updated very quickly, and each time a user browses, the user must browse the latest webpage resources that the user browses.
  • the middleware server sends the currently stored valid original webpage resource to the request when receiving the request information of the other client requesting access to the A webpage for the first time.
  • the client causes the middleware server to fail to get the latest version of the webpage resource in the state where the stored webpage resources of the A webpage are valid.
  • the middleware server periodically interacts with the target server of the A webpage during the validity period of the webpage resource of the A webpage, and when the webpage resource of the webpage has an updated version, The updated version is sent to the middleware server, and when the webpage resource of the A webpage has no updated version, the notification information is sent to the middleware server.
  • all the identifiers corresponding to the webpage address can be found by the webpage address of the A webpage included in the request information.
  • the webpage address of the webpage can be used as the root directory, and when the webpage resource received by the terminal server is the webpage resource under the webpage address, the webpage resource is stored in the webpage address directory.
  • the webpage address may be first found, and then all the identifiers under the webpage address are searched, which is convenient and quick.
  • the method for the present invention to find all the identifiers of the A webpage includes but is not limited thereto.
  • Step S204 Extract the identifier of the latest version from all the identifiers found.
  • the middleware server can simultaneously save the time of storing each version of the webpage when storing the webpage resource, and extract the webpage resource with the latest storage time when extracting the latest version of the identifier.
  • the storage time can also be used as the start time of the validity period.
  • the identification sequence of the updated version of the webpage resource is sequentially labeled, and when the latest version of the identifier is extracted, the identifier with the largest number is directly extracted.
  • Step S205 determining whether the original identifier is the same as the identifier of the latest version, if the original identifier and the identifier The identification of the latest version is different, and step S206 is performed; otherwise, step S210 is performed.
  • the identifiers of the webpage resources of different versions of the A webpage are different.
  • whether the webpage of the webpage is updated by comparing whether the original logo and the latest version of the logo are the same, if not, the latest version is indicated.
  • the new webpage resource version corresponding to the identifier is a new version, respectively reading the new webpage resource and the original webpage resource, and calculating the difference data of the two; when the original identifier is the same as the latest version of the identifier, the original webpage resource is Currently, the latest version of the web page resource, the client directly reads the original web page resource cached by itself.
  • the method described in this embodiment does not need to load a large amount of data of a webpage resource regardless of whether the webpage has an updated version of the webpage resource, which saves loading time and saves traffic.
  • Step S206 It is determined whether the original identifier is stored. If yes, step S207 is performed; otherwise, step S214 is performed.
  • the webpage resource is set in the middleware server with a storage expiration date.
  • the original webpage resource stored in the middleware server and the original webpage resource corresponding to the original identifier may be invalid, or been deleted.
  • the original identifier stored in the middleware server and its corresponding original webpage resource have been deleted. At this time, the original identifier is not stored in the middleware server.
  • step S206 and step S205 may be replaced with each other.
  • step S205 is performed.
  • step S207 is performed.
  • the execution sequence of step S205 and step S206 does not affect the implementation of the technical solution of the present invention, and will not be described in detail herein.
  • Step S207 Read the original webpage resource corresponding to the original identifier.
  • the new webpage resource corresponding to the A webpage has data update with the original webpage resource. If the original webpage resource is stored in the middleware server, the original webpage resource is read to facilitate calculation of the content updated relative to the original webpage resource.
  • Step S208 Calculate difference data of the new webpage resource corresponding to the original webpage resource corresponding to the original identifier and the latest webpage identifier according to the preset rule.
  • the manner of calculating the difference data between the new webpage resource and the original webpage resource may include: calculating the file content and calculating the binary data.
  • the webpage resource corresponding to the A webpage can calculate the difference data through the file content:
  • the content of a part of the original webpage resource is:
  • the generated difference file is:
  • -3 indicates that the original web resource file starts to change the file content on the third line
  • +3 indicates that the new web resource file starts to add the file content in the third line
  • the "-" sign indicates that the following content is deleted in the original web resource file
  • "+ “” indicates that the following content is added to the new web resource file
  • the modified file content is the content indicated in "”.
  • the difference data obtained finally includes: the starting point of the difference, the length of the difference data in the original web resource file, and the new The length and content of the difference data in the web resource file.
  • the binary data of the original web resource file is: AAAAAAAA
  • the binary data of the new web resource file is: AAABAAAA
  • the difference file will be recorded as: the difference data starting byte number of the original web resource file: 3, the length of the difference: 1 , the difference data starting byte number of the new web resource file: 3, the length of the difference data: 1, the content of the difference data: B.
  • Step S209 Send the difference data to the client.
  • the client after receiving the difference data, the client obtains the new webpage resource by calculating the difference data and the original webpage resource of the A webpage according to the inverse operation of the difference data, which is not described in this embodiment.
  • the A webpage requested by the client is a HyperText Markup Language (html) main document, it is represented by c.html in this embodiment.
  • html HyperText Markup Language
  • the client searches for an html main document with a similar webpage address under the same server that has been visited, In this embodiment, the document is recorded as d.html.
  • the request information sent by the client includes the web address of c.html and the original identifier of d.html.
  • the middleware server sends the webpage address of c.html to the target server, and obtains the webpage resource of c.html, and then calculates the difference data of the webpage resource of the d.html corresponding to the original webpage of the c.html webpage resource, and obtains the difference data.
  • the client can obtain the web resource of c.html according to the difference data and the web resource of d.html.
  • the webpage resource of the d.html stored by the client is used as the original webpage resource, and the corresponding identifier is used as the original identifier, and the webpage resource of the received c.html is used as the new webpage resource, and the downloading c is avoided compared with the prior art. All webpage resource data of html.
  • Step S210 Send notification information to the client.
  • the middleware server sends a notification message to the client, notifying the client that the webpage resource is not updated, and the client reads the original webpage resource stored by itself according to the notification information.
  • Step S211 Send the webpage address to the server.
  • the middleware server does not store the effective webpage resource finger, and the middleware server stores the webpage resource corresponding to the A webpage, but the stored webpage resource is invalid, or the middleware server does not store the corresponding webpage of the A webpage.
  • Web resources In either case, the available web resources corresponding to the A webpage are not stored in the middleware server.
  • the middleware server needs to reacquire the webpage to the target server corresponding to the webpage A. Web resources.
  • Step S212 Receive a new webpage resource sent by the server
  • the target server updates the webpage resource and only stores the latest version of the webpage resource
  • the middleware server sends the webpage address of the webpage to the target server
  • the target server sends the new webpage resource of the latest version
  • Step S213 Generate an identifier of the latest version according to the new webpage resource, and execute step S205.
  • the target server sends the new webpage resource corresponding to the A webpage to the middleware server, and the middleware server generates the latest version of the identifier according to the content of the new webpage resource, and stores the new webpage resource and the latest version of the identifier.
  • the middleware server extracts the latest version of the identifier, the step of comparing the latest version of the identifier with the original identifier is performed.
  • Step S214 Send the new webpage resource to the client.
  • the middleware server cannot obtain the original webpage resource according to the original identifier.
  • the client may not be calculated based on the last access of the client.
  • the updated part of the web resource Even if other versions of the webpage resources are stored, the difference data obtained by other versions of the webpage resources cannot be obtained by the same rules or algorithms on the basis of the original webpage resources. Therefore, when the middleware server does not store the original identifier, the new webpage resource can only be sent to the client, and the latest version of the identifier corresponding to the new webpage resource is sent to the client, so that the client requests the next access. Used when using A webpage.
  • the solution described in this implementation points out that when the middleware server does not store new webpage resources, or the stored network When the page resource is invalid, the middleware server interacts with the target server, and calculates the difference data between the new webpage resource and the original webpage resource. It can be seen that as long as the original webpage resource is stored in the middleware server, when there is a new webpage resource, the client can load only the difference data of the new webpage resource and the original webpage resource without loading all the webpage resources.
  • the present invention also shows a webpage resource loading method of the client.
  • the figure shows a flow chart of a method for loading a webpage resource loading method according to a third embodiment of the present invention.
  • the method includes:
  • Step S301 Send the request information to the middleware server.
  • This step corresponds to the implementation manner of the foregoing embodiment, and has been described in detail in the foregoing embodiment, and is not described herein again.
  • Step S302 Receive difference data sent by the middleware server.
  • the client when the webpage resource requested by the client requests the latest version of the new webpage resource, the client only loads the data of the updated part. Certainly, the client receives the difference data and also receives the identifier of the latest version corresponding to the new webpage resource, so that the currently stored webpage resource and the identifier can accurately correspond.
  • Step S303 Calculate the difference data and the original webpage resource according to a preset rule to obtain a new webpage resource.
  • the difference data and the original web resource are obtained by using a preset rule or algorithm to obtain a new web resource.
  • the preset rule for obtaining the difference data is an algorithm
  • the calculation of the new webpage resource by using the difference data is an inverse operation of the unified preset rule of the algorithm.
  • Step S304 Display content of the new webpage resource.
  • the client After receiving the new webpage resource, the client displays the new webpage resource, and writes the new webpage resource and the latest version of the identifier into the cache.
  • the identifier of the latest version stored in this time is sent to the middleware server as the original identifier. If the webpage resource has an updated version, the difference data is obtained based on the newly stored webpage resource, and the amount of the difference data can be reduced. To further save load traffic.
  • displaying the new webpage resource includes the following three situations: first, when receiving the difference data sent by the middleware server, according to the difference data and the original webpage resource stored by the client Generating a new webpage resource and reading the new webpage resource; secondly, when receiving the notification information sent by the middleware server, it indicates that the webpage resource requested by the client does not have an updated version, and the client directly reads the original webpage stored by the client.
  • the resource can be; thirdly, when receiving the new webpage resource sent by the middleware server, the client directly reads the new webpage resource and simultaneously stores the new webpage resource.
  • the client needs to load the complete webpage resource, and the webpage resources frequently accessed by the user are stored in the middleware server. That is to say, in the webpage resource loading method of the embodiment of the present invention, even if the update frequency of the webpage resource with a high user access rate is high, the webpage resource data is not required to be loaded frequently, and the amount of data loaded is greatly reduced, thereby further reducing the amount of data loaded. The traffic consumption of the client.
  • the webpage resource loading method determines that the webpage address corresponds to when the middleware server receives the request information including the webpage address and the original identifier corresponding to the original webpage resource sent by the client.
  • the latest version of the logo When the original identifier is different from the latest version of the identifier, the new webpage resource corresponding to the latest version of the identifier is updated compared to the original webpage resource, and the difference between the original webpage resource and the new webpage resource is calculated. Data, the difference data is sent to the client.
  • the difference data and the original webpage resource are used to generate, by the client, the new webpage resource according to the preset rule.
  • the webpage resources requested by the client are updated, only the difference data of the updated part is loaded, which not only shortens the loading time but also saves traffic.
  • the embodiment of the present invention further provides a webpage resource loading device, as shown in FIG. 4, which is a schematic structural diagram of a first embodiment of a webpage resource loading device according to an embodiment of the present invention.
  • the device includes: a receiving unit 11, a determining unit 12, a calculating unit 13, and a sending unit 14, wherein the receiving unit 11 is configured to receive request information sent by the client, where the request information includes a webpage corresponding to the original webpage resource.
  • the webpage resource loading device of the embodiment determines the identifier of the latest version corresponding to the webpage address when the middleware server receives the request information of the webpage address and the original identifier corresponding to the original webpage resource sent by the client.
  • the new webpage resource corresponding to the latest version of the identifier is updated compared to the original webpage resource, and the difference between the original webpage resource and the new webpage resource is calculated.
  • Data the difference data is sent to the client.
  • the difference data and the original webpage resource are used to generate, by the client, the new webpage resource according to the preset rule.
  • the webpage resources requested by the client are updated, only the difference data of the updated part is loaded, which not only shortens the loading time but also saves traffic.
  • FIG. 5 it is a schematic structural diagram of a second implementation manner of a webpage resource loading apparatus according to an embodiment of the present invention.
  • the device comprises: a receiving unit 21, a determining unit 22, a first determining unit 23, a second determining unit 24, a reading unit 25, a calculating unit 26 and a transmitting unit 27, wherein the receiving unit 21, the determining unit
  • the calculation unit 26 and the sending unit 27 are similar to those in the above embodiment, and the present invention will not be described herein.
  • the first determining unit 23 is configured to determine whether the original identifier is the same as the identifier of the latest version, and the second determining unit 24 is configured to determine, by the second determining unit, whether the original identifier is stored.
  • the reading unit 25 is configured to read the original webpage resource corresponding to the original identifier when the original identifier is stored.
  • the determining unit 22 includes a determining module, and the determining module is configured to determine whether a valid webpage resource corresponding to the webpage address is stored.
  • the determining unit 22 is configured to search for all the identifiers corresponding to the webpage address; extract the identifier of the latest version from all the found identifiers;
  • the determining unit 22 is configured to send the webpage address to the server; receive a new webpage resource sent by the server; and generate the latest version according to the new webpage resource.
  • the sending unit 27 is further configured to send notification information to the client when the original identifier is the same as the identifier of the latest version, where the notification information is used to notify the client.
  • the end reads the original webpage resource.
  • the sending unit 27 is further configured to send notification information to the client when the original identifier is the same as the identifier of the latest version, where the notification information is used to notify the client. Reading the original webpage resource.
  • the solution described in this implementation indicates that when the new webpage resource is not stored in the middleware server, or the stored webpage resource is invalid, the middleware server interacts with the target server, and calculates the difference between the new webpage resource and the original webpage resource.
  • the process of data It can be seen that as long as the original webpage resource is stored in the middleware server, when there is a new webpage resource, the client can load only the difference data of the new webpage resource and the original webpage resource without loading all the webpage resources.
  • FIG. 6 is a schematic structural diagram of a third embodiment of a webpage resource loading apparatus according to an embodiment of the present invention.
  • the apparatus includes: a sending unit 31, a receiving unit 32, a calculating unit 33, and a display unit 34.
  • the sending unit 31 is configured to send the request information to the middleware server, where the request information includes a webpage address corresponding to the original webpage resource and an original identifier corresponding to the original webpage resource, and the receiving unit 32 is configured to receive the middle
  • the difference data sent by the server is configured to calculate the difference data and the original webpage resource according to a preset rule to obtain a new webpage resource
  • the display unit 34 is configured to display the new webpage resource content.
  • the webpage resource loading device of the embodiment determines the identifier of the latest version corresponding to the webpage address when the middleware server receives the request information of the webpage address and the original identifier corresponding to the original webpage resource sent by the client.
  • the new webpage resource corresponding to the latest version of the identifier is updated compared to the original webpage resource, and the difference between the original webpage resource and the new webpage resource is calculated.
  • Data the difference data is sent to the client.
  • the difference data and the original webpage resource are used to generate, by the client, the new webpage resource according to the preset rule.
  • the webpage resources requested by the client are updated, only the difference data of the updated part is loaded, which not only shortens the loading time but also saves traffic.
  • the present invention is applicable to a wide variety of general purpose or special purpose computing system environments or configurations.
  • the invention may 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 invention may also be practiced in distributed computing environments in these distributed computing environments The task is performed by a remote processing device that is connected through a communication network.
  • program modules can be located in both local and remote computer storage media including storage devices.

Abstract

Disclosed is a webpage resource loading method, comprising: receiving request information sent by a client, wherein the request information comprises a webpage address corresponding to an original webpage resource and an original identifier corresponding to the original webpage resource; determining an identifier of a latest version corresponding to the webpage address; when the original identifier is different from the identifier of the latest version, calculating difference data between the original webpage resource corresponding to the original identifier and a new webpage resource corresponding to the identifier of the latest version; and sending the difference data to the client, wherein the difference data and the original webpage resource are used for generating the new webpage resource for the client according to a pre-set rule. Also disclosed is a webpage resource loading device. Compared with the prior art, the webpage resource loading method and device provided in the embodiments of the present invention can not only shorten the loading time but also can save traffic since only difference data of the updated part is loaded when a webpage resource to which the client requests to access is updated.

Description

网页资源加载方法及装置Web resource loading method and device 技术领域Technical field
本发明涉及移动通信技术领域,更具体而言,涉及一种网页资源加载方法及装置。The present invention relates to the field of mobile communication technologies, and in particular, to a webpage resource loading method and apparatus.
背景技术Background technique
随着智能移动终端的普及,越来越多用户通过移动终端浏览器上网浏览网页。鉴于我国无线网络尚未完全覆盖,用户在很多区域,如在公共场合等车,或者乘车过程中,使用数据流量进行网络连接。With the popularity of smart mobile terminals, more and more users browse the web through the mobile terminal browser. In view of the fact that China's wireless network has not been fully covered, users use data traffic for network connection in many areas, such as in public places or during the ride.
通常网页由html文件和css样式文件、js样式文件、图片等文件构成,html文件为主资源,其他文件为子资源。当使用移动终端浏览器第一次浏览某网页时,需要通过网络从服务器上将该网页文件全部加载到该移动终端上进行显示。当第一次浏览后,该网页的部分内容能够在移动终端上缓存。其中,由于html文件变化较快,所以移动终端浏览器将html文件设置为不可缓存的文件,能够缓存的文件为css样式文件、js样式文件及图片文件。再次浏览该网页时,只加载未缓存的html文件部分的资源即可,既能提高加载的速度,也能够节省部分流量。Usually, a web page is composed of an html file and a css style file, a js style file, a picture, and the like. The html file is a main resource, and other files are sub-resources. When the mobile terminal browser is used to browse a certain webpage for the first time, the webpage file needs to be all loaded onto the mobile terminal from the server through the network for display. After the first browsing, part of the content of the webpage can be cached on the mobile terminal. Among them, because the html file changes faster, the mobile terminal browser sets the html file as a non-cacheable file, and the cacheable files are css style files, js style files, and picture files. When you browse the page again, you can only load the resources of the uncached html file part, which can increase the loading speed and save some traffic.
然而,一个网页中html文件平均大小为37.55KB,占网页大小的12%,因此,虽然再次浏览网页时,仅重新加载html文件,但是加载消耗时间较长,所消耗的数据流量也非常大。However, the average size of an html file in a web page is 37.55 KB, which is 12% of the page size. Therefore, although the html file is only reloaded when browsing the web page again, the loading takes a long time and the data traffic consumed is very large.
发明内容Summary of the invention
有鉴于此,本发明实施例提供一种网页资源加载方法及装置,能够在移动终端浏览器再次浏览网页时,避免重复加载网页,不仅能够缩短加载的时间,而且能够节省流量。In view of this, the embodiment of the present invention provides a method and a device for loading a webpage resource, which can prevent the webpage from being repeatedly loaded when the webpage of the mobile terminal browses the webpage again, which can not only shorten the loading time but also save traffic.
第一方面,本发明实施例提供了一种网页资源加载方法,所述方法包括:接收客户端发送的请求信息,所述请求信息包括网页资源对应的网页地址和所述网页资源对应的原标识;中间件服务器获取所述网页地址对应的网页资源,确定所述网页地址对应的最新版本的标识;当所述原标识与所述最新版本的标识不同时,计算所述原标识对应的原网页资源与所述最新版本的标识对应的新网页资源的差异数据;将所述差异数据发送到所述客户端,利用所述差异数据和所述原网页资源生成所述新网页资源进行加载。 In a first aspect, an embodiment of the present invention provides a method for loading a webpage resource, where the method includes: receiving request information sent by a client, where the request information includes a webpage address corresponding to the webpage resource and an original identifier corresponding to the webpage resource. The middleware server obtains the webpage resource corresponding to the webpage address, and determines the identifier of the latest version corresponding to the webpage address; when the original identifier is different from the identifier of the latest version, the original webpage corresponding to the original identifier is calculated. The difference data of the new webpage resource corresponding to the latest version of the identifier; the difference data is sent to the client, and the new webpage resource is generated by using the difference data and the original webpage resource for loading.
第二方面,一种网页资源加载方法,包括:向中间件服务器发送请求信息,所述请求信息包括网页资源对应的网页地址和所述网页资源对应的原标识;接收所述中间件服务器返回的网页资源对应的最新版本的标识,以及原网页资源与新网页资源的差异数据;利用所述差异数据和所述原网页资源生成所述新网页资源进行加载。A second aspect, a method for loading a webpage resource, comprising: sending request information to a middleware server, where the request information includes a webpage address corresponding to the webpage resource and an original identifier corresponding to the webpage resource; and receiving the return of the middleware server The identifier of the latest version corresponding to the webpage resource, and the difference data of the original webpage resource and the new webpage resource; generating the new webpage resource by using the difference data and the original webpage resource for loading.
此外,本发明实施例还提供可分别与第一方面、第二方面和第三方面对应的网页资源加载装置以及存储介质和程序。In addition, the embodiment of the present invention further provides a webpage resource loading device and a storage medium and a program, which are respectively corresponding to the first aspect, the second aspect, and the third aspect.
由以上技术方案可知,本发明实施例所提供的网页资源加载方法及装置,当中间件服务器接收到客户端发送的包含与网页资源对应的网页地址及原标识的请求信息时,确定所述网页地址对应的最新版本的标识。当所述原标识与所述最新版本的标识不同时,说明所述最新版本的标识对应的新网页资源较所述原网页资源有更新,计算所述原网页资源与所述新网页资源的差异数据,将所述差异数据发送到客户端。其中,所述差异数据和所述原网页资源用于为所述客户端根据所述预设规则生成所述新网页资源。与现有技术相比,当客户端请求访问的网页资源有更新时,只加载更新部分的差异数据,不仅能够缩短加载时间,而且节省流量。According to the above technical solution, the method and device for loading a webpage resource provided by the embodiment of the present invention, when the middleware server receives the request information of the webpage address and the original identifier corresponding to the webpage resource sent by the client, determining the webpage The ID of the latest version corresponding to the address. When the original identifier is different from the latest version of the identifier, the new webpage resource corresponding to the latest version of the identifier is updated compared to the original webpage resource, and the difference between the original webpage resource and the new webpage resource is calculated. Data, the difference data is sent to the client. The difference data and the original webpage resource are used to generate, by the client, the new webpage resource according to the preset rule. Compared with the prior art, when the webpage resources requested by the client are updated, only the difference data of the updated part is loaded, which not only shortens the loading time but also saves traffic.
附图说明DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。通过附图所示,本发明的上述及其它目的、特征和优势将更加清晰。在全部附图中相同的附图标记指示相同的部分。并未刻意按实际尺寸等比例缩放绘制附图,重点在于示出本发明的主旨。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings to be used in the embodiments will be briefly described below. Obviously, the drawings in the following description are only some of the present invention. For the embodiments, those skilled in the art can obtain other drawings according to the drawings without any creative work. The above and other objects, features and advantages of the present invention will become apparent from the accompanying drawings. The same reference numerals are used throughout the drawings to refer to the same parts. The drawings are not intended to be scaled to scale in actual size, with emphasis on the gist of the present invention.
图1为本发明实施例提供的网页资源加载第一种方法实施方式的方法流程图;1 is a flowchart of a method for loading a first method of webpage resource loading according to an embodiment of the present invention;
图2为本发明实施例提供的网页资源加载方法第二种实施方式的方法流程图;2 is a flowchart of a method for loading a webpage resource according to a second embodiment of the present invention;
图3为本发明实施例提供的网页资源加载方法第三种实施方式的方法流程图;FIG. 3 is a flowchart of a method for loading a webpage resource according to a third embodiment of the present invention;
图4为本发明实施例提供的网页资源加载装置第一种实施方式的结构示意图;FIG. 4 is a schematic structural diagram of a first embodiment of a webpage resource loading apparatus according to an embodiment of the present disclosure;
图5为本发明实施例提供的网页资源加载装置第二种实施方式的结构示意图;FIG. 5 is a schematic structural diagram of a second implementation manner of a webpage resource loading apparatus according to an embodiment of the present disclosure;
图6为本发明实施例提供的网页资源加载装置第三种实施方式的结构示意图。 FIG. 6 is a schematic structural diagram of a third embodiment of a webpage resource loading apparatus according to an embodiment of the present invention.
具体实施方式detailed description
为了使本发明的技术方案适用性更广,本发明引入中间件服务器,中间件服务器为客户端的代理服务器,将客户端及服务器的修改放置到该中间件服务器中进行,使本发明的技术方案具有良好的兼容性。In order to make the technical solution of the present invention more applicable, the present invention introduces a middleware server, which is a proxy server of a client, and puts a modification of a client and a server into the middleware server, so that the technical solution of the present invention Has good compatibility.
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整的描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
参见图1,为本发明实施例提供的网页资源加载方法第一种实施方式的方法流程图。所述方法包括:FIG. 1 is a flowchart of a method for loading a webpage resource according to a first embodiment of the present invention. The method includes:
步骤S101:接收客户端发送的请求信息。Step S101: Receive request information sent by the client.
其中,当客户端第一次请求访问A网页时,请求信息中包括A网页的网页地址,用于中间件服务器根据该网页地址获取A网页的网页资源;当客户端第N(N大于等于2)次访问A网页时,请求信息中不仅包括A网页的网页地址,还包括上次访问A网页时网页资源对应的标识。由于中间件服务器中对应A网页的网页地址可以存储有多个版本的网页资源,每个版本的网页资源对应一个标识,本发明中将请求信息中包含的标识作为原标识,该原标识对应的网页资源作为原网页资源。When the client requests to access the A webpage for the first time, the request information includes the webpage address of the A webpage, and the middleware server obtains the webpage resource of the A webpage according to the webpage address; when the client is Nth (N is greater than or equal to 2) When accessing the A webpage, the request information includes not only the webpage address of the webpage of A, but also the identifier corresponding to the webpage resource when the webpage was last visited. The webpage address corresponding to the A webpage in the middleware server can store multiple versions of webpage resources, and each version of the webpage resource corresponds to one identifier. In the present invention, the identifier included in the request information is used as the original identifier, and the original identifier corresponds to the original identifier. The web resource is used as the original web resource.
需要指出的,本发明实施例可以满足多种应用场景,客户端可以为智能移动终端,IPAD、电脑等;中间件服务器可以设置在与客户端建立通信连接的网络中。It should be noted that the embodiment of the present invention can satisfy various application scenarios, and the client can be an intelligent mobile terminal, an IPAD, a computer, etc.; the middleware server can be set in a network that establishes a communication connection with the client.
步骤S102:确定所述网页资源对应的最新版本的标识。Step S102: Determine an identifier of the latest version corresponding to the webpage resource.
其中,A网页的网页资源不断更新,每更新一个版本生成一个与该版本的网页资源唯一对应的标识,当客户端再次访问A网页时,中间件服务器中可以存储有多个更新版本的A网页的网页资源,每个更新版本对应一个标识。当然,A网页的网页资源此时也可能没有更新版本,原网页资源即为当前最新版本的网页资源。The webpage resource of the A webpage is continuously updated, and each updated version generates an identifier uniquely corresponding to the webpage resource of the version. When the client accesses the webpage again, the middleware server may store multiple updated versions of the webpage A. Web resources, each updated version corresponds to an identifier. Of course, the webpage resources of the A webpage may not have an updated version at this time, and the original webpage resource is the current latest version of the webpage resource.
需要指出的,本实施例中,最新版本的标识指当前最新版本的网页资源所对应的标识。本发明实施例中,可以通过读取中间件服务器中A网页的网页地址对应的全部标识,从所读取的全部标识中确定最新版本的标识。由此可以看出,标识的设置,能够明确清 楚的指示出网页资源是否存在更新,通过查找标识的方式查找不同版本的网页资源更加方便快捷。It should be noted that, in this embodiment, the identifier of the latest version refers to the identifier corresponding to the current latest version of the webpage resource. In the embodiment of the present invention, the latest version of the identifier may be determined from all the identifiers read by reading all the identifiers corresponding to the webpage address of the A webpage in the middleware server. It can be seen that the setting of the logo can be clearly cleared. Chu indicates whether there is an update of the webpage resource, and it is more convenient and quick to find the webpage resources of different versions by looking up the identifier.
步骤S103:当所述原标识与所述最新版本的标识不同时,根据预设规则计算所述原标识对应的原网页资源与所述最新版本的标识对应的新网页资源的差异数据。Step S103: When the original identifier is different from the identifier of the latest version, calculate difference data of the new webpage resource corresponding to the original webpage resource corresponding to the original identifier and the latest webpage resource according to the preset rule.
由于标识根据网页资源的内容生成,所以当原标识与最新版本的标识不同时,表示最新版本的标识所对应的新网页资源与原标识所对应的原网页资源内容不同,即,新网页资源是当前最新版本的网页资源,然后,根据预设规则或者算法计算得到新网页资源与原网页资源的差异数据,从而准确方便的得到网页资源更新的部分及更新的内容。本实施例通过对比原标识与新标识,判断网页资源是否有更新,与直接对比网页资源相比,比对的内容大幅减少,使比对过程更加方便快捷,操作过程更简单。Since the identifier is generated according to the content of the webpage resource, when the original identifier is different from the identifier of the latest version, the new webpage resource corresponding to the identifier of the latest version is different from the original webpage resource content corresponding to the original identifier, that is, the new webpage resource is The current version of the webpage resource, and then calculating the difference data between the new webpage resource and the original webpage resource according to a preset rule or algorithm, thereby accurately and conveniently obtaining the updated part of the webpage resource and the updated content. In this embodiment, by comparing the original identifier with the new identifier, it is determined whether the webpage resource is updated. Compared with directly comparing the webpage resources, the compared content is greatly reduced, which makes the comparison process more convenient and quick, and the operation process is simpler.
步骤S104:将所述差异数据发送到所述客户端。Step S104: Send the difference data to the client.
本实施例中,仅将包含更新部分及更新内容的差异数据发送给客户端,客户端通过与得到差异数据相同的预设规则或算法,在原网页资源的基础上得到新网页资源。与传统的将更新的网页资源全部加载的方式相比,不仅能够缩短加载时间,而且能够大幅节省加载流量。In this embodiment, only the difference data including the updated part and the updated content is sent to the client, and the client obtains the new webpage resource on the basis of the original webpage resource by using the same preset rule or algorithm as the difference data. Compared with the traditional way of loading all the updated web resources, not only can the loading time be shortened, but also the loading traffic can be greatly saved.
需要指出的,中间件服务器向客户端发送差异数据时,还可以将新网页资源对应的最新版本标识发送给客户端,当客户端计算得到新网页资源后,最新版本的标识用于标记新网页资源。当客户端再次请求访问A网页时,将最新版本的标识作为原标识发送到中间件服务器。It should be noted that when the middleware server sends the difference data to the client, the latest version identifier corresponding to the new webpage resource may be sent to the client. When the client calculates the new webpage resource, the latest version of the identifier is used to mark the new webpage. Resources. When the client requests access to the A webpage again, the latest version of the identifier is sent to the middleware server as the original identifier.
由上述实施例可知,本发明实施例所提供的网页资源加载方法,当中间件服务器接收到客户端发送的包含与原网页资源对应的网页地址及原标识的请求信息时,确定所述网页地址对应的最新版本的标识。当所述原标识与所述最新版本的标识不同时,说明所述最新版本的标识对应的新网页资源较所述原网页资源有更新,计算所述原网页资源与所述新网页资源的差异数据,将所述差异数据发送到客户端。其中,所述差异数据和所述原网页资源用于为所述客户端根据所述预设规则生成所述新网页资源。与现有技术相比,当客户端请求访问的网页资源有更新时,只加载更新部分的差异数据,不仅能够缩短加载时间,而且节省流量。According to the above embodiment, the webpage resource loading method provided by the embodiment of the present invention determines the webpage address when the middleware server receives the request information of the webpage address and the original identifier corresponding to the original webpage resource sent by the client. Corresponding to the latest version of the logo. When the original identifier is different from the latest version of the identifier, the new webpage resource corresponding to the latest version of the identifier is updated compared to the original webpage resource, and the difference between the original webpage resource and the new webpage resource is calculated. Data, the difference data is sent to the client. The difference data and the original webpage resource are used to generate, by the client, the new webpage resource according to the preset rule. Compared with the prior art, when the webpage resources requested by the client are updated, only the difference data of the updated part is loaded, which not only shortens the loading time but also saves traffic.
为了使本领域技术人员更加详细、清楚的了解本发明的技术方案,本发明通过下述 实施例对本发明的技术方案进行详细描述。In order to enable those skilled in the art to understand the technical solutions of the present invention in more detail and clearly, the present invention is as follows. The embodiments describe the technical solutions of the present invention in detail.
如图2,本图为本发明实施例提供的网页资源加载方法第二种实施方式的方法流程图,所述方法包括:FIG. 2 is a flowchart of a method for loading a webpage resource according to a second embodiment of the present invention, where the method includes:
步骤S201:接收客户端发送的请求信息。Step S201: Receive request information sent by the client.
当客户端第一次发送请求信息请求访问A网页时,中间件服务器根据请求信息所包含的A网页的网页地址查找是否存储有该网页地址对应的网页资源,若存储有且网页资源有效时,将该网页资源及其对应的标识发送到客户端,其中,关于网页资源是否有效在本实施例后面的描述中有进行详细介绍。客户端保存该网页资源及其对应的标识,当客户端再次请求访问A网页的网页资源时,将网页地址及所存储的标识发送给中间件服务器,当网页资源存在更新版本的新网页资源时,将接收的标识作为原标识查找其对应的原网页资源,并计算原网页资源与新网页资源的差异数据。When the client sends the request information for the first time to access the A webpage, the middleware server searches whether the webpage resource corresponding to the webpage address is stored according to the webpage address of the webpage included in the request information, and if the webpage resource is valid, The webpage resource and its corresponding identifier are sent to the client, and details about whether the webpage resource is valid are described in the following description of the embodiment. The client saves the webpage resource and its corresponding identifier. When the client requests to access the webpage resource of the webpage again, the webpage address and the stored identifier are sent to the middleware server, when the webpage resource has a new version of the webpage resource with the updated version. The received identifier is used as the original identifier to search for the corresponding original webpage resource, and the difference data between the original webpage resource and the new webpage resource is calculated.
需要指出的,本发明实施例中的标识根据网页资源内容通过哈希算法或者其他计算机算法计算生成,因此,不同网页资源对应唯一的标识。通过哈希算法或者其他计算机算法生成标识是本领域技术人员所熟知的技术,本发明此处不再赘述。It should be noted that the identifiers in the embodiments of the present invention are generated by using a hash algorithm or other computer algorithms according to the content of the webpage resources. Therefore, different webpage resources correspond to unique identifiers. The generation of the identification by a hash algorithm or other computer algorithm is a technique well known to those skilled in the art, and the present invention will not be described herein.
步骤S202:判断是否存储有与所述网页地址对应的有效网页资源;当存储有时,执行步骤S203;否则,执行步骤S211。Step S202: It is determined whether a valid webpage resource corresponding to the webpage address is stored; when it is stored, step S203 is performed; otherwise, step S211 is performed.
本实施例中,为了提高中间件服务器的利用率,中间件服务器能够与多个客户端建立连接,使得中间件服务器能够存储多种不同网页的网页资源,每种网页对应有多个不同版本的网页资源。由于中间件服务器的存储空间有限,而且部分网页的更新速度不同,例如,新浪微博的更新频率非常高,网易门户网站的更新频率相对比较低。因此,中间件服务器所存储的网页资源均设置有有效期,本申请中,在有效期内的网页资源称为有效网页资源,超过有效期,便认为该网页资源是无效的状态,称为无效网页资源。当网页资源处于无效状态预设时间后,中间件服务器清除该网页资源,不仅能够合理利用中间件服务器的存储空间,而且能够及时更新中间件服务器中的网页资源。其中,相同网页地址对应的网页资源有效期相同。In this embodiment, in order to improve the utilization rate of the middleware server, the middleware server can establish a connection with multiple clients, so that the middleware server can store webpage resources of a plurality of different webpages, and each webpage corresponds to multiple different versions. Web resources. Due to the limited storage space of the middleware server and the different update speeds of some web pages, for example, the update frequency of Sina Weibo is very high, and the update frequency of the NetEase portal website is relatively low. Therefore, the webpage resources stored in the middleware server are all set to have an expiration date. In the present application, the webpage resource in the validity period is called a valid webpage resource, and when the expiration date is exceeded, the webpage resource is considered to be in an invalid state, and is called an invalid webpage resource. After the webpage resource is in an invalid state for a preset time, the middleware server clears the webpage resource, and not only can reasonably utilize the storage space of the middleware server, but also can timely update the webpage resource in the middleware server. The webpage resources corresponding to the same webpage address have the same validity period.
需要指出的,网页资源的有效期可以通过时长设置,不同网页的网页资源有效时长可以做不同设置,例如,门户网站的有效时长可以设置为一周,微博网站的有效时长可以设置为十分钟。同理,网页资源无效后清空的预设时间也可以自行设置。时长的设置 可以根据网页的更新频率和浏览次数设置,本发明对此不做限制。It should be noted that the validity period of the webpage resource can be set by the duration, and the effective duration of the webpage resources of different webpages can be set differently. For example, the effective duration of the webpage can be set to one week, and the effective duration of the microblogging website can be set to ten minutes. Similarly, the preset time to clear after the web resource is invalid can also be set by itself. Duration setting The invention can be set according to the update frequency of the webpage and the number of times of browsing, and the present invention does not limit this.
中间件服务器接收到A网页的请求信息后,根据网页地址查找是否存储有相应的网页资源,当存储有网页资源时,判断所存储的网页资源所是否有效,根据网页资源的不同状态采取不同措施。After receiving the request information of the A webpage, the middleware server searches whether the webpage resource is stored according to the webpage address, and when the webpage resource is stored, determines whether the stored webpage resource is valid, and takes different measures according to different states of the webpage resource. .
步骤S203:查找所述网页地址对应的全部标识。Step S203: Find all the identifiers corresponding to the webpage address.
当中间件服务器中存储的网页资源有效时,确定A网页到本次读取时所有的更新版本。由上述描述可知,很多网页资源更新速度很快,用户每次浏览时,必须满足用户所浏览的是最新的网页资源。而当所存储的A网页的原网页资源处于有效状态时,中间件服务器接收到其他客户端第一次请求访问A网页的请求信息时,均将当前所存储的有效的原网页资源发送到发出请求的客户端,造成中间件服务器在已存储的A网页的网页资源有效的状态下,无法得到最新版本的网页资源。为了保证用户能够读取到最新版本的网页资源,中间件服务器在A网页的网页资源有效期内,周期性的与A网页的目标服务器进行信息交互,当A网页的网页资源有更新版本时,将更新版本发送给中间件服务器,当A网页的网页资源没有更新版本时,向中间件服务器发送告知信息。When the webpage resource stored in the middleware server is valid, all the updated versions of the A webpage to the current reading are determined. As can be seen from the above description, many webpage resources are updated very quickly, and each time a user browses, the user must browse the latest webpage resources that the user browses. When the original webpage resource of the stored A webpage is in a valid state, the middleware server sends the currently stored valid original webpage resource to the request when receiving the request information of the other client requesting access to the A webpage for the first time. The client causes the middleware server to fail to get the latest version of the webpage resource in the state where the stored webpage resources of the A webpage are valid. In order to ensure that the user can read the latest version of the webpage resource, the middleware server periodically interacts with the target server of the A webpage during the validity period of the webpage resource of the A webpage, and when the webpage resource of the webpage has an updated version, The updated version is sent to the middleware server, and when the webpage resource of the A webpage has no updated version, the notification information is sent to the middleware server.
本实施例中,可以通过请求信息包含的A网页的网页地址查找该网页地址对应的全部标识。例如,存储时,可以将A网页的网页地址作为根目录,终端服务器接收的网页资源为该网页地址下的网页资源时,将该网页资源存储在该网页地址目录下。当需要查找该网页地址对应的全部标识时,可以首先查找到该网页地址,然后查找该网页地址下的全部标识,方便快捷。当然,上述仅为一个优选示例,本发明查找A网页全部标识的方法包括但不限于此。In this embodiment, all the identifiers corresponding to the webpage address can be found by the webpage address of the A webpage included in the request information. For example, when storing, the webpage address of the webpage can be used as the root directory, and when the webpage resource received by the terminal server is the webpage resource under the webpage address, the webpage resource is stored in the webpage address directory. When it is necessary to find all the identifiers corresponding to the webpage address, the webpage address may be first found, and then all the identifiers under the webpage address are searched, which is convenient and quick. Of course, the foregoing is only a preferred example, and the method for the present invention to find all the identifiers of the A webpage includes but is not limited thereto.
步骤S204:从所查找的全部标识中提取所述最新版本的标识。Step S204: Extract the identifier of the latest version from all the identifiers found.
为了便于提取A网页最新版本的网页资源对应的标识,中间件服务器在存储网页资源时,可以同时保存A网页每个版本存入的时间,当提取最新版本的标识时提取存储时间最近的网页资源对应的标识。同时,存储时间还能够作为有效期的开始计时间。或者,存储时按照A网页的更新时间对更新版本的网页资源的标识顺序标号,提取最新版本的标识时直接提取编号最大的标识。当然,上述仅为本发明实施例的优选示例,对本发明的技术方案造成任何限制。In order to facilitate the extraction of the identifier corresponding to the latest version of the webpage resource of the A webpage, the middleware server can simultaneously save the time of storing each version of the webpage when storing the webpage resource, and extract the webpage resource with the latest storage time when extracting the latest version of the identifier. Corresponding identifier. At the same time, the storage time can also be used as the start time of the validity period. Or, in the storage, according to the update time of the A webpage, the identification sequence of the updated version of the webpage resource is sequentially labeled, and when the latest version of the identifier is extracted, the identifier with the largest number is directly extracted. Of course, the above is only a preferred example of the embodiment of the present invention, and imposes any limitation on the technical solution of the present invention.
步骤S205:判断所述原标识与所述最新版本的标识是否相同,若所述原标识与所述 最新版本的标识不同,执行步骤S206;否则,执行步骤S210。Step S205: determining whether the original identifier is the same as the identifier of the latest version, if the original identifier and the identifier The identification of the latest version is different, and step S206 is performed; otherwise, step S210 is performed.
由上述实施例可知,不同版本的A网页的网页资源对应的标识不同,本实施例中通过比对原标识与最新版本的标识是否相同判断A网页是否有更新,若不相同,表示该最新版本的标识对应的新网页资源版本为新版本,分别读取出该新网页资源与原网页资源,并计算二者的差异数据;当原标识与最新版本的标识相同时,表示原网页资源即为当前最新版本的网页资源,客户端直接读取自身缓存的原网页资源即可。It can be seen that the identifiers of the webpage resources of different versions of the A webpage are different. In this embodiment, whether the webpage of the webpage is updated by comparing whether the original logo and the latest version of the logo are the same, if not, the latest version is indicated. The new webpage resource version corresponding to the identifier is a new version, respectively reading the new webpage resource and the original webpage resource, and calculating the difference data of the two; when the original identifier is the same as the latest version of the identifier, the original webpage resource is Currently, the latest version of the web page resource, the client directly reads the original web page resource cached by itself.
本实施例所述的方法,无论A网页是否有更新版本的网页资源,均无须大量加载网页资源的数据,既节省加载时间,又节省流量。The method described in this embodiment does not need to load a large amount of data of a webpage resource regardless of whether the webpage has an updated version of the webpage resource, which saves loading time and saves traffic.
步骤S206:判断是否存储有所述原标识,若存储有,执行步骤S207;否则,执行步骤S214。Step S206: It is determined whether the original identifier is stored. If yes, step S207 is performed; otherwise, step S214 is performed.
由上述描述可知,网页资源在中间件服务器中设置有存储有效期,当某一个客户端再次访问A网页时,中间件服务器中存储的原标识及原标识对应的原网页资源可能已经无效,或者已经被删除。尤其是本次访问距离上次访问的时间过长时,中间件服务器存储的原标识及其相对应的原网页资源已经删除,此时中间件服务器中未存储该原标识。It can be seen from the above description that the webpage resource is set in the middleware server with a storage expiration date. When a certain client accesses the webpage again, the original webpage resource stored in the middleware server and the original webpage resource corresponding to the original identifier may be invalid, or been deleted. In particular, when the current access time is too long, the original identifier stored in the middleware server and its corresponding original webpage resource have been deleted. At this time, the original identifier is not stored in the middleware server.
需要指出的,本实施例中,步骤S206与步骤S205的执行顺序可以相互置换。当然,置换后,当中间件服务器存储有原标识时,执行步骤S205,当步骤S205的执行结果为原标识与最新版本的标识不相同时,执行步骤S207。步骤S205与步骤S206的执行顺序对发明技术方案的实现不会产生影响,此处不再详述。It should be noted that, in this embodiment, the execution order of step S206 and step S205 may be replaced with each other. Of course, after the replacement, when the middleware server stores the original identifier, step S205 is performed. When the execution result of step S205 is that the original identifier is different from the identifier of the latest version, step S207 is performed. The execution sequence of step S205 and step S206 does not affect the implementation of the technical solution of the present invention, and will not be described in detail herein.
步骤S207:读取所述原标识对应的所述原网页资源。Step S207: Read the original webpage resource corresponding to the original identifier.
当原标识与最新版本的标识不同时,说明A网页对应的新网页资源与原网页资源有数据更新。如果中间件服务器中存储有原网页资源时,读取该原网页资源,以便于计算相对于原网页资源更新的内容。When the original identifier is different from the latest version of the identifier, the new webpage resource corresponding to the A webpage has data update with the original webpage resource. If the original webpage resource is stored in the middleware server, the original webpage resource is read to facilitate calculation of the content updated relative to the original webpage resource.
步骤S208:根据预设规则计算所述原标识对应的原网页资源与所述最新版本的标识对应的新网页资源的差异数据。Step S208: Calculate difference data of the new webpage resource corresponding to the original webpage resource corresponding to the original identifier and the latest webpage identifier according to the preset rule.
计算新网页资源与原网页资源的差异数据的方式可以包括:计算文件内容和计算二进制数据两种。例如:A网页对应的网页资源,通过文件内容计算差异数据的方式可以为: The manner of calculating the difference data between the new webpage resource and the original webpage resource may include: calculating the file content and calculating the binary data. For example, the webpage resource corresponding to the A webpage can calculate the difference data through the file content:
原网页资源中某部分文件内容为:The content of a part of the original webpage resource is:
OLD:OLD:
int registerWebView(JNIEnv*env)Int registerWebView(JNIEnv*env)
Figure PCTCN2014093700-appb-000001
Figure PCTCN2014093700-appb-000001
新网页资源该部分文件的内容:The content of this part of the new web resource:
NEW:NEW:
int registerWebView(JNIEnv*env)Int registerWebView(JNIEnv*env)
Figure PCTCN2014093700-appb-000002
Figure PCTCN2014093700-appb-000002
生成的差异文件为:The generated difference file is:
@@-3,7+3,7@@WebView(JNIEnv*env,jobject javaWebView,int viewImpl,WTF::String drawableDir,@@-3,7+3,7@@WebView(JNIEnv*env,jobject javaWebView, int viewImpl,WTF::String drawableDir,
int registerWebView(JNIEnv*env)Int registerWebView(JNIEnv*env)
Figure PCTCN2014093700-appb-000003
Figure PCTCN2014093700-appb-000003
Figure PCTCN2014093700-appb-000004
Figure PCTCN2014093700-appb-000004
其中,-3表示原网页资源文件在第3行开始改动文件内容,+3表示新网页资源文件在第三行开始添加文件内容;“-”号表示在原网页资源文件中删除以下内容,“+”表示在新网页资源文件中增加以下内容,所修改的文件内容为“”内表示的内容。Wherein, -3 indicates that the original web resource file starts to change the file content on the third line, +3 indicates that the new web resource file starts to add the file content in the third line; the "-" sign indicates that the following content is deleted in the original web resource file, "+ "" indicates that the following content is added to the new web resource file, and the modified file content is the content indicated in "".
当然,也可以通过二进制的方式计算,其计算方法可以有很多种,本发明此处不再赘述,但是最终得到的差异数据均包括:差异的起点,原网页资源文件中差异数据的长度,新网页资源文件中差异数据的长度及内容。假如原网页资源文件的二进制数据为:AAAAAAAA;新网页资源文件的二进制数据为:AAABAAAA,那么,差异文件会记录为:原网页资源文件的差异数据开始字节数:3,差异的长度:1,新网页资源文件的差异数据开始字节数:3,差异数据的长度:1,差异数据的内容:B。Of course, it can also be calculated in a binary manner. There are many calculation methods, and the present invention will not be repeated here, but the difference data obtained finally includes: the starting point of the difference, the length of the difference data in the original web resource file, and the new The length and content of the difference data in the web resource file. If the binary data of the original web resource file is: AAAAAAAA; the binary data of the new web resource file is: AAABAAAA, then the difference file will be recorded as: the difference data starting byte number of the original web resource file: 3, the length of the difference: 1 , the difference data starting byte number of the new web resource file: 3, the length of the difference data: 1, the content of the difference data: B.
当然,上述仅为本发明的优选示例,计算差异数据的方法有很多种,本发明在此不再赘述。Of course, the foregoing is only a preferred example of the present invention, and there are many methods for calculating the difference data, and the present invention will not be described herein.
步骤S209:将所述差异数据发送到所述客户端。Step S209: Send the difference data to the client.
由上述实施例可知,客户端接收到差异数据后,按照得到差异数据的逆运算通过计算差异数据与A网页的原网页资源,得到新网页资源,本实施例此处不再赘述。It can be seen from the above embodiment that after receiving the difference data, the client obtains the new webpage resource by calculating the difference data and the original webpage resource of the A webpage according to the inverse operation of the difference data, which is not described in this embodiment.
需要指出的,当客户端请求访问的A网页为超文本标记(HyperText Markup Language,html)主文档,本实施例中用c.html表示。当中间件服务器中未存储有c.html相应的网页资源时,为了避免下载全部c.html网页资源的数据,在客户端查找一个曾访问过的同一个服务器下网页地址相似的html主文档,本实施例中记该文档为d.html。客户端所发送的请求信息中包括c.html的网页地址和d.html的原标识。中间件服务器将c.html的网页地址发送到目标服务器,并获取c.html的网页资源,然后计算c.html的网页资源与原标识对应的d.html的网页资源的差异数据,得到差异数据。客户端根据该差异数据和d.html的网页资源计算便可以得到c.html的网页资源。其中,客户端存储的d.html的网页资源作为原网页资源,其对应的标识作为原标识,接收到的c.html的网页资源作为新网页资源,与现有技术相比,避免下载c.html的全部网页资源数据。 It should be noted that when the A webpage requested by the client is a HyperText Markup Language (html) main document, it is represented by c.html in this embodiment. When the corresponding webpage resource of c.html is not stored in the middleware server, in order to avoid downloading the data of all c.html webpage resources, the client searches for an html main document with a similar webpage address under the same server that has been visited, In this embodiment, the document is recorded as d.html. The request information sent by the client includes the web address of c.html and the original identifier of d.html. The middleware server sends the webpage address of c.html to the target server, and obtains the webpage resource of c.html, and then calculates the difference data of the webpage resource of the d.html corresponding to the original webpage of the c.html webpage resource, and obtains the difference data. . The client can obtain the web resource of c.html according to the difference data and the web resource of d.html. The webpage resource of the d.html stored by the client is used as the original webpage resource, and the corresponding identifier is used as the original identifier, and the webpage resource of the received c.html is used as the new webpage resource, and the downloading c is avoided compared with the prior art. All webpage resource data of html.
步骤S210:向所述客户端发送通知信息。Step S210: Send notification information to the client.
由上述实施例可知,当最新版本的标识与原标识相同时,说明网页资源未更新。为了减少不必要的加载,从而减少流量浪费,中间件服务器向客户端发送通知信息,通知客户端,网页资源未更新,客户端根据该通知信息读取其自身存储的原网页资源。It can be seen from the above embodiment that when the identifier of the latest version is the same as the original identifier, the webpage resource is not updated. In order to reduce unnecessary loading, thereby reducing traffic waste, the middleware server sends a notification message to the client, notifying the client that the webpage resource is not updated, and the client reads the original webpage resource stored by itself according to the notification information.
步骤S211:将所述网页地址发送给服务器。Step S211: Send the webpage address to the server.
本实施例中,中间件服务器未存储有有效网页资源指,中间件服务器存储有A网页对应的网页资源,但是,所存储的网页资源已经无效,或者中间件服务器中未存储有A网页对应的网页资源。无论哪种情况,中间件服务器中均未存储有A网页对应的可用的网页资源,为了能够及时更新中间件服务器中的网页资源,中间件服务器需要向A网页对应的目标服务器重新获取A网页的网页资源。In this embodiment, the middleware server does not store the effective webpage resource finger, and the middleware server stores the webpage resource corresponding to the A webpage, but the stored webpage resource is invalid, or the middleware server does not store the corresponding webpage of the A webpage. Web resources. In either case, the available web resources corresponding to the A webpage are not stored in the middleware server. In order to update the webpage resources in the middleware server in time, the middleware server needs to reacquire the webpage to the target server corresponding to the webpage A. Web resources.
步骤S212:接收所述服务器发送的新网页资源;Step S212: Receive a new webpage resource sent by the server;
由于目标服务器对网页资源进行更新,且只存储最新版本的网页资源,因此,当中间件服务器将A网页的网页地址发送到目标服务器时,目标服务器所发送的为当前最新版本的新网页资源。Since the target server updates the webpage resource and only stores the latest version of the webpage resource, when the middleware server sends the webpage address of the webpage to the target server, the target server sends the new webpage resource of the latest version.
步骤S213:根据所述新网页资源生成所述最新版本的标识,并执行步骤S205。Step S213: Generate an identifier of the latest version according to the new webpage resource, and execute step S205.
目标服务器将A网页对应的新网页资源发送到中间件服务器,中间件服务器根据新网页资源的内容生成最新版本的标识,并存储该新网页资源及最新版本的标识。当中间件服务器提取该最新版本的标识后,执行比较最新版本的标识与原标识的步骤。The target server sends the new webpage resource corresponding to the A webpage to the middleware server, and the middleware server generates the latest version of the identifier according to the content of the new webpage resource, and stores the new webpage resource and the latest version of the identifier. After the middleware server extracts the latest version of the identifier, the step of comparing the latest version of the identifier with the original identifier is performed.
步骤S214:将所述新网页资源发送给所述客户端。Step S214: Send the new webpage resource to the client.
当中间件服务器中未存储原网页资源时,中间件服务器无法根据原标识获取到原网页资源,当本次访问的A网页对应的网页资源存在更新版本时,无法计算得到基于客户端上次访问的网页资源所更新的部分。即使存储有其他版本的网页资源,但是根据其他版本的网页资源计算得到的差异数据,通过相同的规则或者算法无法在原网页资源的基础上得到新网页资源。因此,当中间件服务器未存储原标识时,只能将新网页资源发送给所述客户端,同时将该新网页资源对应的最新版本的标识发送给客户端,以便于客户端下次请求访问A网页时使用。When the original webpage resource is not stored in the middleware server, the middleware server cannot obtain the original webpage resource according to the original identifier. When the webpage resource corresponding to the A webpage accessed this time has an updated version, the client may not be calculated based on the last access of the client. The updated part of the web resource. Even if other versions of the webpage resources are stored, the difference data obtained by other versions of the webpage resources cannot be obtained by the same rules or algorithms on the basis of the original webpage resources. Therefore, when the middleware server does not store the original identifier, the new webpage resource can only be sent to the client, and the latest version of the identifier corresponding to the new webpage resource is sent to the client, so that the client requests the next access. Used when using A webpage.
本实施所述的方案,指出了当中间件服务器中未存储新网页资源,或者所存储的网 页资源无效时,中间件服务器与目标服务器进行交互,并计算得到新网页资源与原网页资源的差异数据的过程。可以看出,只要中间件服务器中存储有原网页资源,当存在新网页资源时,客户端就能够只加载新网页资源与原网页资源的差异数据,而无须加载全部网页资源。The solution described in this implementation points out that when the middleware server does not store new webpage resources, or the stored network When the page resource is invalid, the middleware server interacts with the target server, and calculates the difference data between the new webpage resource and the original webpage resource. It can be seen that as long as the original webpage resource is stored in the middleware server, when there is a new webpage resource, the client can load only the difference data of the new webpage resource and the original webpage resource without loading all the webpage resources.
与中间件服务器端的实现方法相对应,本发明还示出了客户端的网页资源加载方法。如图3所示,该图示出了本发明实施例提供的网页资源加载方法第三种实施方式的方法流程图。Corresponding to the implementation method of the middleware server side, the present invention also shows a webpage resource loading method of the client. As shown in FIG. 3, the figure shows a flow chart of a method for loading a webpage resource loading method according to a third embodiment of the present invention.
所述方法包括:The method includes:
步骤S301:向中间件服务器发送请求信息。Step S301: Send the request information to the middleware server.
本步骤与上述实施例实现方式对应,在上述实施例中已有详细描述,本发明此处不再赘述。This step corresponds to the implementation manner of the foregoing embodiment, and has been described in detail in the foregoing embodiment, and is not described herein again.
步骤S302:接收所述中间件服务器发送的差异数据。Step S302: Receive difference data sent by the middleware server.
与上述实施例相对应,当客户端请求访问的网页资源存在最新版本的新网页资源时,客户端只加载更新部分的数据。当然,客户端接收到差异数据的同时还会接收到新网页资源对应的最新版本的标识,以便于使当前存储的网页资源与标识能够准确对应。Corresponding to the above embodiment, when the webpage resource requested by the client requests the latest version of the new webpage resource, the client only loads the data of the updated part. Certainly, the client receives the difference data and also receives the identifier of the latest version corresponding to the new webpage resource, so that the currently stored webpage resource and the identifier can accurately correspond.
步骤S303:根据预设规则计算所述差异数据及所述原网页资源得到新网页资源。Step S303: Calculate the difference data and the original webpage resource according to a preset rule to obtain a new webpage resource.
将差异数据和原网页资源通过预设规则或算法得到新网页资源。其中,如果得到差异数据的预设规则为某种算法,那么利用差异数据计算得到新网页资源采用的是该算法的统一预设规则的逆运算。计算得到差异数据的具体方法在上述实施例中已经做了详细描述,对差异数据进行逆运算的运算方法为本领域技术人员所熟知的技术,本发明此处不再赘述。The difference data and the original web resource are obtained by using a preset rule or algorithm to obtain a new web resource. Wherein, if the preset rule for obtaining the difference data is an algorithm, the calculation of the new webpage resource by using the difference data is an inverse operation of the unified preset rule of the algorithm. The specific method for calculating the difference data has been described in detail in the above embodiments, and the operation method for performing the inverse operation on the difference data is a technique well known to those skilled in the art, and the present invention will not be described herein.
步骤S304:显示所述新网页资源的内容。Step S304: Display content of the new webpage resource.
客户端接收到新网页资源后,显示该新网页资源,并将该新网页资源及最新版本的标识写入缓存。当再次访问时,将本次存储的最新版本的标识作为原标识发送到中间件服务器,如果网页资源有更新版本,在本次存储的新网页资源基础上获取差异数据,能够减少差异数据的量,从而进一步节省加载流量。 After receiving the new webpage resource, the client displays the new webpage resource, and writes the new webpage resource and the latest version of the identifier into the cache. When accessing again, the identifier of the latest version stored in this time is sent to the middleware server as the original identifier. If the webpage resource has an updated version, the difference data is obtained based on the newly stored webpage resource, and the amount of the difference data can be reduced. To further save load traffic.
与上述实施例相对应的,本实施例中,显示新网页资源包括以下三种情况:第一,当接收到中间件服务器发送的差异数据时,根据差异数据及客户端所存储的原网页资源生成新网页资源,并读取该新网页资源;第二,当接收到中间件服务器发送的通知信息时,说明客户端请求访问的网页资源无更新版本,客户端直接读取自身存储的原网页资源即可;第三,当接收到中间件服务器发送的新网页资源时,客户端直接读取该新网页资源,同时存储该新网页资源。Corresponding to the foregoing embodiment, in the embodiment, displaying the new webpage resource includes the following three situations: first, when receiving the difference data sent by the middleware server, according to the difference data and the original webpage resource stored by the client Generating a new webpage resource and reading the new webpage resource; secondly, when receiving the notification information sent by the middleware server, it indicates that the webpage resource requested by the client does not have an updated version, and the client directly reads the original webpage stored by the client. The resource can be; thirdly, when receiving the new webpage resource sent by the middleware server, the client directly reads the new webpage resource and simultaneously stores the new webpage resource.
从本实施例可以看出,只有中间件服务器未存储客户端请求访问的网页资源时,客户端才需要加载完整的网页资源,而用户经常访问的网页资源在中间件服务器中均有存储。也就是说,本发明实施例的网页资源加载方法,用户访问率较高的网页资源即使更新频率较高也依然无须经常大量加载网页资源数据,大幅度减少了加载的数据量,从而进一步减少了客户端的流量消耗。As can be seen from the embodiment, only when the middleware server does not store the webpage resources requested by the client, the client needs to load the complete webpage resource, and the webpage resources frequently accessed by the user are stored in the middleware server. That is to say, in the webpage resource loading method of the embodiment of the present invention, even if the update frequency of the webpage resource with a high user access rate is high, the webpage resource data is not required to be loaded frequently, and the amount of data loaded is greatly reduced, thereby further reducing the amount of data loaded. The traffic consumption of the client.
通过以上描述可知,本发明实施例所提供的网页资源加载方法,当中间件服务器接收到客户端发送的包含与原网页资源对应的网页地址及原标识的请求信息时,确定所述网页地址对应的最新版本的标识。当所述原标识与所述最新版本的标识不同时,说明所述最新版本的标识对应的新网页资源较所述原网页资源有更新,计算所述原网页资源与所述新网页资源的差异数据,将所述差异数据发送到客户端。其中,所述差异数据和所述原网页资源用于为所述客户端根据所述预设规则生成所述新网页资源。与现有技术相比,当客户端请求访问的网页资源有更新时,只加载更新部分的差异数据,不仅能够缩短加载时间,而且节省流量。The above description shows that the webpage resource loading method provided by the embodiment of the present invention determines that the webpage address corresponds to when the middleware server receives the request information including the webpage address and the original identifier corresponding to the original webpage resource sent by the client. The latest version of the logo. When the original identifier is different from the latest version of the identifier, the new webpage resource corresponding to the latest version of the identifier is updated compared to the original webpage resource, and the difference between the original webpage resource and the new webpage resource is calculated. Data, the difference data is sent to the client. The difference data and the original webpage resource are used to generate, by the client, the new webpage resource according to the preset rule. Compared with the prior art, when the webpage resources requested by the client are updated, only the difference data of the updated part is loaded, which not only shortens the loading time but also saves traffic.
与上述实现方法相对应的,本发明实施例还提供了网页资源加载装置,如图4所示,为本发明实施例提供的网页资源加载装置第一种实施方式的结构示意图。所述装置包括:接收单元11、确定单元12、计算单元13和发送单元14,其中,所述接收单元11,用于接收客户端发送的请求信息,所述请求信息包括原网页资源对应的网页地址和所述原网页资源对应的原标识;所述确定单元12,用于确定所述网页地址对应的最新版本的标识;所述计算单元13,用于当所述原标识与所述最新版本的标识不同时,根据预设规则计算所述原标识对应的原网页资源与所述最新版本的标识对应的新网页资源的差异数据;所述发送单元14,用于将所述差异数据发送到所述客户端,所述差异数据和所述原网页资源用于为所述客户端根据所述预设规则生成所述新网页资源。Corresponding to the foregoing implementation method, the embodiment of the present invention further provides a webpage resource loading device, as shown in FIG. 4, which is a schematic structural diagram of a first embodiment of a webpage resource loading device according to an embodiment of the present invention. The device includes: a receiving unit 11, a determining unit 12, a calculating unit 13, and a sending unit 14, wherein the receiving unit 11 is configured to receive request information sent by the client, where the request information includes a webpage corresponding to the original webpage resource. An original identifier corresponding to the original webpage resource; the determining unit 12, configured to determine an identifier of a latest version corresponding to the webpage address; the calculating unit 13 is configured to: when the original identifier and the latest version When the identifiers are different, the difference data of the new webpage resources corresponding to the original webpage resource corresponding to the latest version of the original identifier is calculated according to the preset rule; the sending unit 14 is configured to send the difference data to The client, the difference data and the original webpage resource are used to generate, by the client, the new webpage resource according to the preset rule.
所述装置中各个单元的功能和作用的实现过程详见上述方法中对应的实现过程,在 此不再赘述。The implementation process of the functions and functions of each unit in the device is described in the corresponding implementation process in the above method. This will not be repeated here.
本实施例的网页资源加载装置,当中间件服务器接收到客户端发送的包含与原网页资源对应的网页地址及原标识的请求信息时,确定所述网页地址对应的最新版本的标识。当所述原标识与所述最新版本的标识不同时,说明所述最新版本的标识对应的新网页资源较所述原网页资源有更新,计算所述原网页资源与所述新网页资源的差异数据,将所述差异数据发送到客户端。其中,所述差异数据和所述原网页资源用于为所述客户端根据所述预设规则生成所述新网页资源。与现有技术相比,当客户端请求访问的网页资源有更新时,只加载更新部分的差异数据,不仅能够缩短加载时间,而且节省流量。The webpage resource loading device of the embodiment determines the identifier of the latest version corresponding to the webpage address when the middleware server receives the request information of the webpage address and the original identifier corresponding to the original webpage resource sent by the client. When the original identifier is different from the latest version of the identifier, the new webpage resource corresponding to the latest version of the identifier is updated compared to the original webpage resource, and the difference between the original webpage resource and the new webpage resource is calculated. Data, the difference data is sent to the client. The difference data and the original webpage resource are used to generate, by the client, the new webpage resource according to the preset rule. Compared with the prior art, when the webpage resources requested by the client are updated, only the difference data of the updated part is loaded, which not only shortens the loading time but also saves traffic.
为了更加详细的介绍本发明的技术方案,本发明还提供了上述实施例的扩展实施方式,如图5所示,为本发明实施例提供的网页资源加载装置第二种实施方式的结构示意图。所述装置包括:接收单元21,确定单元22、第一判断单元23、第二判断单元24、读取单元25、计算单元26和发送单元27,其中,所述接收单元21、所述确定单元22、所述计算单元26和所述发送单元27与上述实施例中的描述类似,本发明此处不再赘述。所述第一判断单元23,用于判断所述原标识与所述最新版本的标识是否相同;所述第二判断单元24,用于所述第二判断单元:判断是否存储有所述原标识;所述读取单元25,用于在存储有所述原标识时,读取所述原标识对应的所述原网页资源。In order to introduce the technical solution of the present invention in more detail, the present invention further provides an extended implementation manner of the foregoing embodiment. As shown in FIG. 5, it is a schematic structural diagram of a second implementation manner of a webpage resource loading apparatus according to an embodiment of the present invention. The device comprises: a receiving unit 21, a determining unit 22, a first determining unit 23, a second determining unit 24, a reading unit 25, a calculating unit 26 and a transmitting unit 27, wherein the receiving unit 21, the determining unit The calculation unit 26 and the sending unit 27 are similar to those in the above embodiment, and the present invention will not be described herein. The first determining unit 23 is configured to determine whether the original identifier is the same as the identifier of the latest version, and the second determining unit 24 is configured to determine, by the second determining unit, whether the original identifier is stored. The reading unit 25 is configured to read the original webpage resource corresponding to the original identifier when the original identifier is stored.
在上述实施例的基础上,本实施例中,所述确定单元22包括判断模块,判断模块用于判断是否存储有与所述网页地址对应的有效网页资源。在存储有与所述网页地址对应的有效网页资源时,所述确定单元22用于查找所述网页地址对应的全部标识;从所查找的全部标识中提取所述最新版本的标识;在未存储有与所述网页地址对应的有效网页资源时,所述确定单元22用于将所述网页地址发送给服务器;接收所述服务器发送的新网页资源;根据所述新网页资源生成所述最新版本的标识。On the basis of the foregoing embodiment, in the embodiment, the determining unit 22 includes a determining module, and the determining module is configured to determine whether a valid webpage resource corresponding to the webpage address is stored. When the valid webpage resource corresponding to the webpage address is stored, the determining unit 22 is configured to search for all the identifiers corresponding to the webpage address; extract the identifier of the latest version from all the found identifiers; When there is a valid webpage resource corresponding to the webpage address, the determining unit 22 is configured to send the webpage address to the server; receive a new webpage resource sent by the server; and generate the latest version according to the new webpage resource. Logo.
其中,在本实施例中,所述发送单元27在所述原标识与所述最新版本的标识相同时,还用于向所述客户端发送通知信息,所述通知信息用于通知所述客户端读取所述原网页资源。In the embodiment, the sending unit 27 is further configured to send notification information to the client when the original identifier is the same as the identifier of the latest version, where the notification information is used to notify the client. The end reads the original webpage resource.
在另一实施例中,所述发送单元27在所述原标识与所述最新版本的标识相同时,还用于向所述客户端发送通知信息,所述通知信息用于通知所述客户端读取所述原网页资源。In another embodiment, the sending unit 27 is further configured to send notification information to the client when the original identifier is the same as the identifier of the latest version, where the notification information is used to notify the client. Reading the original webpage resource.
所述装置中各个单元的功能和作用的实现过程详见上述方法中对应的实现过程,在 此不再赘述。The implementation process of the functions and functions of each unit in the device is described in the corresponding implementation process in the above method. This will not be repeated here.
本实施所述的方案,指出了当中间件服务器中未存储新网页资源,或者所存储的网页资源无效时,中间件服务器与目标服务器进行交互,并计算得到新网页资源与原网页资源的差异数据的过程。可以看出,只要中间件服务器中存储有原网页资源,当存在新网页资源时,客户端就能够只加载新网页资源与原网页资源的差异数据,而无须加载全部网页资源。The solution described in this implementation indicates that when the new webpage resource is not stored in the middleware server, or the stored webpage resource is invalid, the middleware server interacts with the target server, and calculates the difference between the new webpage resource and the original webpage resource. The process of data. It can be seen that as long as the original webpage resource is stored in the middleware server, when there is a new webpage resource, the client can load only the difference data of the new webpage resource and the original webpage resource without loading all the webpage resources.
与中间件服务器端相对应,本发明还示出了客户端装置的结构。如图6,该图为本发明实施例提供的网页资源加载装置第三种实施方式的结构示意图,所述装置包括:发送单元31、接收单元32、计算单元33和显示单元34,其中,所述发送单元31,用于向中间件服务器发送请求信息,所述请求信息包括原网页资源对应的网页地址和所述原网页资源对应的原标识;所述接收单元32,用于接收所述中间件服务器发送的差异数据;所述计算单元33,用于根据预设规则计算所述差异数据及所述原网页资源得到新网页资源;所述显示单元34,用于显示所述新网页资源的内容。Corresponding to the middleware server side, the present invention also shows the structure of the client device. FIG. 6 is a schematic structural diagram of a third embodiment of a webpage resource loading apparatus according to an embodiment of the present invention. The apparatus includes: a sending unit 31, a receiving unit 32, a calculating unit 33, and a display unit 34. The sending unit 31 is configured to send the request information to the middleware server, where the request information includes a webpage address corresponding to the original webpage resource and an original identifier corresponding to the original webpage resource, and the receiving unit 32 is configured to receive the middle The difference data sent by the server; the calculating unit 33 is configured to calculate the difference data and the original webpage resource according to a preset rule to obtain a new webpage resource; the display unit 34 is configured to display the new webpage resource content.
所述装置中各个单元的功能和作用的实现过程详见上述方法中对应的实现过程,在此不再赘述。For the implementation process of the function and the function of each unit in the device, refer to the corresponding implementation process in the foregoing method, and details are not described herein again.
本实施例的网页资源加载装置,当中间件服务器接收到客户端发送的包含与原网页资源对应的网页地址及原标识的请求信息时,确定所述网页地址对应的最新版本的标识。当所述原标识与所述最新版本的标识不同时,说明所述最新版本的标识对应的新网页资源较所述原网页资源有更新,计算所述原网页资源与所述新网页资源的差异数据,将所述差异数据发送到客户端。其中,所述差异数据和所述原网页资源用于为所述客户端根据所述预设规则生成所述新网页资源。与现有技术相比,当客户端请求访问的网页资源有更新时,只加载更新部分的差异数据,不仅能够缩短加载时间,而且节省流量。The webpage resource loading device of the embodiment determines the identifier of the latest version corresponding to the webpage address when the middleware server receives the request information of the webpage address and the original identifier corresponding to the original webpage resource sent by the client. When the original identifier is different from the latest version of the identifier, the new webpage resource corresponding to the latest version of the identifier is updated compared to the original webpage resource, and the difference between the original webpage resource and the new webpage resource is calculated. Data, the difference data is sent to the client. The difference data and the original webpage resource are used to generate, by the client, the new webpage resource according to the preset rule. Compared with the prior art, when the webpage resources requested by the client are updated, only the difference data of the updated part is loaded, which not only shortens the loading time but also saves traffic.
可以理解的是,本发明可用于众多通用或专用的计算系统环境或配置中。例如:个人计算机、服务器计算机、手持设备或便携式设备、平板型设备、多处理器系统、基于微处理器的系统、置顶盒、可编程的消费电子设备、网络PC、小型计算机、大型计算机、包括以上任何系统或设备的分布式计算环境等等。It will be appreciated that the present invention is applicable to a wide variety of general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor based systems, set-top boxes, programmable consumer electronics devices, network PCs, small computers, mainframe computers, including A distributed computing environment of any of the above systems or devices, and the like.
本发明可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本发明,在这些分布式计算环境 中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。The invention may 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 invention may also be practiced in distributed computing environments in these distributed computing environments The task is performed by a remote processing device that is 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.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this context, relational terms such as first and second are used merely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply such entities or operations. There is any such actual relationship or order between them. Furthermore, the term "comprises" or "comprises" or "comprises" or any other variations thereof is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device that comprises a plurality of elements includes not only those elements but also Other elements, or elements that are inherent to such a process, method, item, or device. An element that is defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device that comprises the element.
以上所述仅是本发明的具体实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。 The above is only a specific embodiment of the present invention, and it should be noted that those skilled in the art can also make several improvements and retouchings without departing from the principles of the present invention. It should be considered as the scope of protection of the present invention.

Claims (20)

  1. 一种网页资源加载方法,其特征在于,所述方法包括:A method for loading a webpage resource, the method comprising:
    接收客户端发送的请求信息,所述请求信息包括网页资源对应的网页地址和所述网页资源对应的原标识;Receiving the request information sent by the client, where the request information includes a webpage address corresponding to the webpage resource and an original identifier corresponding to the webpage resource;
    中间件服务器获取所述网页地址对应的网页资源,确定所述网页资源对应的最新版本的标识;The middleware server acquires the webpage resource corresponding to the webpage address, and determines the identifier of the latest version corresponding to the webpage resource;
    当所述原标识与所述最新版本的标识不同时,计算所述原标识对应的原网页资源与所述最新版本的标识对应的新网页资源的差异数据;When the original identifier is different from the identifier of the latest version, calculating difference data of the new webpage resource corresponding to the original webpage resource corresponding to the latest identifier;
    将所述差异数据发送到所述客户端,利用所述差异数据和所述原网页资源生成所述新网页资源进行加载。Sending the difference data to the client, generating the new webpage resource by using the difference data and the original webpage resource for loading.
  2. 如权利要求1所述的方法,其特征在于,所述中间件服务器获取所述网页资源,确定所述网页资源对应的最新版本的标识包括:The method of claim 1, wherein the middleware server obtains the webpage resource, and the identifier of the latest version corresponding to the webpage resource is determined to include:
    判断所述中间件服务器是否存储有与所述网页地址对应的有效网页资源;Determining whether the middleware server stores a valid webpage resource corresponding to the webpage address;
    若存储有与所述网页地址对应的有效网页资源,查找所述网资源对应的全部标识,从所查找的全部标识中提取所述最新版本的标识;If the valid webpage resource corresponding to the webpage address is stored, all the identifiers corresponding to the network resource are searched, and the latest version of the identifier is extracted from all the found identifiers;
    若未存储有与所述网页地址对应的有效网页资源,根据所述网页地址从目标服务器获取新网页资源,根据所述新网页资源生成所述最新版本的标识。If the valid webpage resource corresponding to the webpage address is not stored, the new webpage resource is obtained from the target server according to the webpage address, and the latest version of the identifier is generated according to the new webpage resource.
  3. 如权利要求2所述的方法,其特征在于,所述中间件服务器获取所述网页资源,确定所述网页资源对应的最新版本的标识之后,所述方法还包括:The method according to claim 2, wherein after the middleware server acquires the webpage resource and determines the identifier of the latest version corresponding to the webpage resource, the method further includes:
    当所述原标识与所述最新版本的标识相同时,向所述客户端发送通知信息,所述通知信息用于通知所述客户端读取所述网页资源。And when the original identifier is the same as the identifier of the latest version, sending, to the client, notification information, where the notification information is used to notify the client to read the webpage resource.
  4. 如权利要求1至3中任一权项所述的方法,其特征在于,当所述原标识与所述最新版本的标识不同时,计算所述原标识对应的原网页资源与所述最新版本的标识对应的新网页资源的差异数据之前,所述方法还包括:The method according to any one of claims 1 to 3, wherein when the original identifier is different from the identifier of the latest version, calculating an original webpage resource corresponding to the original identifier and the latest version Before the identifier corresponding to the difference data of the new webpage resource, the method further includes:
    判断是否存储有所述原标识;Determining whether the original identifier is stored;
    若存储有所述原标识,读取所述原标识对应的所述原网页资源;If the original identifier is stored, reading the original webpage resource corresponding to the original identifier;
    若未存储有所述原标识,将所述新网页资源发送给所述客户端。If the original identifier is not stored, the new webpage resource is sent to the client.
  5. 如权利要求2所述的方法,其特征在于,如果未存储有效的网页资源,并且请求访问的所述网页资源为HTML文件,则查找与所述网页资源至少根目录相同的HTML文件作为新网页资源,根据所述新网页资源生成所述最新版本的标识。The method according to claim 2, wherein if a valid webpage resource is not stored, and the webpage resource requested to be accessed is an HTML file, an HTML file having the same root directory as the webpage resource is searched for as a new webpage. a resource, generating an identifier of the latest version according to the new webpage resource.
  6. 如权利要求1所述的方法,其特征在于,所述网页资源对应的标识包括根据所述网页资源计算得到的哈希值。The method according to claim 1, wherein the identifier corresponding to the webpage resource comprises a hash value calculated according to the webpage resource.
  7. 如权利要求1所述的方法,其特征在于,所述网页资源为HTML文档、层叠样式表、脚本或图片。The method of claim 1 wherein the web page resource is an HTML document, a cascading style sheet, a script, or a picture.
  8. 一种网页资源加载方法,其特征在于,包括: A method for loading a webpage resource, comprising:
    向中间件服务器发送请求信息,所述请求信息包括网页资源对应的网页地址和所述网页资源对应的原标识;Sending request information to the middleware server, where the request information includes a webpage address corresponding to the webpage resource and an original identifier corresponding to the webpage resource;
    接收所述中间件服务器返回的所述网页资源对应的最新版本的标识,以及原网页资源与新网页资源的差异数据;Receiving an identifier of the latest version corresponding to the webpage resource returned by the middleware server, and difference data of the original webpage resource and the new webpage resource;
    利用所述差异数据和所述原网页资源生成所述新网页资源进行加载。Generating the new webpage resource by using the difference data and the original webpage resource for loading.
  9. 如权利要求8所述的一种网页资源加载方法,其特征在于,所述利用所述差异数据和所述原网页资源生成所述新网页资源进行加载的步骤后,还包括:The method for loading a webpage resource according to claim 8, wherein the step of using the difference data and the original webpage resource to generate the new webpage resource for loading further comprises:
    所述客户端更新所述网页资源及其对应的标识。The client updates the webpage resource and its corresponding identifier.
  10. 如权利要求8或9所述的一种网页资源加载方法,其特征在于,如果所述中间件服务器返回的所述最新版本的标识与所述原标识相同,则读取客户端中缓存的网页资源进行加载。The method for loading a webpage resource according to claim 8 or 9, wherein if the identifier of the latest version returned by the middleware server is the same as the original identifier, the webpage cached in the client is read. The resource is loaded.
  11. 一种网页资源加载装置,包括一个或多个计算机,以及一个或多个存储有计算机可执行指令的存储器,其特征在于,当所述可执行指令被执行时,使得一个或多个计算机执行如下步骤:A web resource loading device comprising one or more computers, and one or more memories storing computer executable instructions, wherein when the executable instructions are executed, causing one or more computers to execute as follows step:
    接收客户端发送的请求信息,所述请求信息包括网页资源对应的网页地址和所述原网页资源对应的原标识;Receiving the request information sent by the client, where the request information includes a webpage address corresponding to the webpage resource and an original identifier corresponding to the original webpage resource;
    中间件服务器获取所述网页地址对应的网页资源,确定所述网页资源对应的最新版本的标识;The middleware server acquires the webpage resource corresponding to the webpage address, and determines the identifier of the latest version corresponding to the webpage resource;
    当所述原标识与所述最新版本的标识不同时,计算所述原标识对应的原网页资源与所述最新版本的标识对应的新网页资源的差异数据;When the original identifier is different from the identifier of the latest version, calculating difference data of the new webpage resource corresponding to the original webpage resource corresponding to the latest identifier;
    将所述差异数据发送到所述客户端,利用所述差异数据和所述原网页资源生成所述新网页资源进行加载。Sending the difference data to the client, generating the new webpage resource by using the difference data and the original webpage resource for loading.
  12. 如权利要求11所述的装置,其特征在于,所述中间件服务器获取所述网页资源,确定所述网页资源对应的最新版本的标识包括:The device according to claim 11, wherein the middleware server acquires the webpage resource, and the identifier of the latest version corresponding to the webpage resource is determined to include:
    判断所述中间件服务器是否存储有与所述网页地址对应的有效网页资源;Determining whether the middleware server stores a valid webpage resource corresponding to the webpage address;
    若存储有与所述网页地址对应的有效网页资源,查找所述网页地址对应的全部标识,从所查找的全部标识中提取所述最新版本的标识;If the valid webpage resource corresponding to the webpage address is stored, search for all the identifiers corresponding to the webpage address, and extract the latest version of the identifier from all the found identifiers;
    若未存储有与所述网页地址对应的有效网页资源,根据所述网页地址从目标服务器获取新网页资源,根据所述新网页资源生成所述最新版本的标识。。If the valid webpage resource corresponding to the webpage address is not stored, the new webpage resource is obtained from the target server according to the webpage address, and the latest version of the identifier is generated according to the new webpage resource. .
  13. 如权利要求12所述的装置,其特征在于,所述中间件服务器获取所述网页资源,确定所述网页资源对应的最新版本的标识之后,还包括:The device according to claim 12, wherein the middleware server obtains the webpage resource, and after determining the identifier of the latest version corresponding to the webpage resource, the method further includes:
    当所述原标识与所述最新版本的标识相同时,向所述客户端发送通知信息,所述通知信息用于通知所述客户端读取所述原网页资源。And when the original identifier is the same as the identifier of the latest version, sending, to the client, notification information, where the notification information is used to notify the client to read the original webpage resource.
  14. 如权利要求11至13中任一权项所述的装置,其特征在于,当所述原标识与所 述最新版本的标识不同时,计算所述原标识对应的原网页资源与所述最新版本的标识对应的新网页资源的差异数据之前,所述方法还包括:Apparatus according to any one of claims 11 to 13 wherein said original identification and The method further includes: before calculating the difference data of the new webpage resource corresponding to the original webpage resource corresponding to the latest version of the identifier of the latest version, the method further includes:
    判断是否存储有所述原标识;Determining whether the original identifier is stored;
    若存储有所述原标识,读取所述原标识对应的所述原网页资源;If the original identifier is stored, reading the original webpage resource corresponding to the original identifier;
    若未存储有所述原标识,将所述新网页资源发送给所述客户端。If the original identifier is not stored, the new webpage resource is sent to the client.
  15. 一种网页资源加载装置,包含一个或多个处理器,以及一个或多个存储有计算机可执行指令的存储器,其特征在于,当所述可执行指令被执行时,使得处理器执行如下步骤:A web resource loading apparatus comprising one or more processors and one or more memories storing computer executable instructions, wherein when the executable instructions are executed, causing the processor to perform the following steps:
    向中间件服务器发送请求信息,所述请求信息包括原网页资源对应的网页地址和所述原网页资源对应的原标识;Sending request information to the middleware server, where the request information includes a webpage address corresponding to the original webpage resource and an original identifier corresponding to the original webpage resource;
    接收所述中间件服务器返回的所述网页资源对应的最新版本的标识,以及原网页资源与新网页资源的差异数据;Receiving an identifier of the latest version corresponding to the webpage resource returned by the middleware server, and difference data of the original webpage resource and the new webpage resource;
    利用所述差异数据和所述原网页资源生成所述新网页资源进行加载。Generating the new webpage resource by using the difference data and the original webpage resource for loading.
  16. 如权利要求15所述的一种网页资源加载装置,其特征在于,所述利用所述差异数据和所述原网页资源生成所述新网页资源进行加载的步骤后,还包括:The device for loading a webpage resource according to claim 15, wherein the step of generating the new webpage resource by using the difference data and the original webpage resource to perform loading comprises:
    所述客户端更新所述网页资源及其对应的标识。The client updates the webpage resource and its corresponding identifier.
  17. 如权利要求15或16所述的一种网页资源加载装置,其特征在于,如果所述中间件服务器返回的所述最新版本的标识与所述原标识相同,则读取客户端中缓存的网页资源进行加载。The webpage resource loading apparatus according to claim 15 or 16, wherein if the identifier of the latest version returned by the middleware server is the same as the original identifier, the webpage cached in the client is read. The resource is loaded.
  18. 一种非易失性计算机可读存储介质,其中存储有计算机可执行指令,当处理器执行所述计算机可执行指令时,执行以下步骤:A non-transitory computer readable storage medium having stored therein computer executable instructions that, when executed by a processor, perform the following steps:
    接收客户端发送的请求信息,所述请求信息包括网页资源对应的网页地址和所述原网页资源对应的原标识;Receiving the request information sent by the client, where the request information includes a webpage address corresponding to the webpage resource and an original identifier corresponding to the original webpage resource;
    中间件服务器获取所述网页地址对应的网页资源,确定所述网页资源对应的最新版本的标识;The middleware server acquires the webpage resource corresponding to the webpage address, and determines the identifier of the latest version corresponding to the webpage resource;
    当所述原标识与所述最新版本的标识不同时,计算所述原标识对应的原网页资源与所述最新版本的标识对应的新网页资源的差异数据;When the original identifier is different from the identifier of the latest version, calculating difference data of the new webpage resource corresponding to the original webpage resource corresponding to the latest identifier;
    将所述差异数据发送到所述客户端,利用所述差异数据和所述原网页资源生成所述新网页资源进行加载。Sending the difference data to the client, generating the new webpage resource by using the difference data and the original webpage resource for loading.
  19. 一种非易失性计算机可读存储介质,其中存储有计算机可执行指令,当处理器执行所述计算机可执行指令时,执行以下步骤:A non-transitory computer readable storage medium having stored therein computer executable instructions that, when executed by a processor, perform the following steps:
    向中间件服务器发送请求信息,所述请求信息包括原网页资源对应的网页地址和所述原网页资源对应的原标识;Sending request information to the middleware server, where the request information includes a webpage address corresponding to the original webpage resource and an original identifier corresponding to the original webpage resource;
    接收所述中间件服务器返回的所述网页资源对应的最新版本的标识,以及原网页资 源与新网页资源的差异数据;Receiving the identifier of the latest version corresponding to the webpage resource returned by the middleware server, and the original webpage resource Difference data between source and new web resources;
    利用所述差异数据和所述原网页资源生成所述新网页资源进行加载。Generating the new webpage resource by using the difference data and the original webpage resource for loading.
  20. 一种程序,包含权利要求1-10任一项所述方法的步骤。 A program comprising the steps of the method of any of claims 1-10.
PCT/CN2014/093700 2014-04-25 2014-12-12 Webpage resource loading method and device WO2015161658A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410172691.3A CN105095226B (en) 2014-04-25 2014-04-25 Web page resources loading method and device
CN201410172691.3 2014-04-25

Publications (1)

Publication Number Publication Date
WO2015161658A1 true WO2015161658A1 (en) 2015-10-29

Family

ID=54331707

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/093700 WO2015161658A1 (en) 2014-04-25 2014-12-12 Webpage resource loading method and device

Country Status (2)

Country Link
CN (1) CN105095226B (en)
WO (1) WO2015161658A1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109948087A (en) * 2017-12-05 2019-06-28 广东欧珀移动通信有限公司 Acquisition methods, device and the terminal of web page resources
CN110362333A (en) * 2019-06-29 2019-10-22 上海淇馥信息技术有限公司 A kind of quick solution, device and electronic equipment that client upgrading hinders
CN112817700A (en) * 2021-02-25 2021-05-18 北京顶象技术有限公司 Method and device for realizing active updating of client script and computer equipment
CN113010811A (en) * 2019-12-20 2021-06-22 北京百度网讯科技有限公司 Webpage acquisition method and device, electronic equipment and computer readable storage medium
CN113472888A (en) * 2021-07-07 2021-10-01 挂号网(杭州)科技有限公司 Webpage access method, device, server equipment and storage medium

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105607927A (en) * 2015-12-18 2016-05-25 小米科技有限责任公司 Page display method and apparatus
CN106933865A (en) * 2015-12-31 2017-07-07 北京五八信息技术有限公司 The resource loading method and device of mobile applications web application
CN105956005B (en) * 2016-04-20 2019-06-07 曹屹 A kind of data processing method and equipment
CN107404508B (en) * 2016-05-20 2021-04-27 阿里巴巴集团控股有限公司 Client page access method, client and electronic equipment
CN106294844A (en) * 2016-08-19 2017-01-04 乐视控股(北京)有限公司 Browsing device net page loading processing method and device
CN106528587B (en) * 2016-09-12 2020-12-08 腾讯科技(深圳)有限公司 Page display method and device in composite webpage system
CN109241474B (en) * 2017-07-11 2022-08-05 阿里巴巴集团控股有限公司 Method for providing, displaying and releasing page information, server and client
CN107528896B (en) * 2017-08-18 2021-11-09 腾讯科技(深圳)有限公司 Access information processing method and device and computer storage medium
CN110555118B (en) * 2018-03-28 2022-08-16 武汉斗鱼网络科技有限公司 Method and device for loading picture
CN109376320B (en) * 2018-09-26 2021-01-15 苏州浪潮智能科技有限公司 Method and device for updating data items of webpage interface
CN109359259A (en) * 2018-09-27 2019-02-19 广州酷狗计算机科技有限公司 Load the method and device of webpage
CN109819033A (en) * 2019-01-25 2019-05-28 杭州迪普科技股份有限公司 A kind of resource file loading method and system
CN111741038B (en) * 2019-03-25 2022-02-25 华为技术有限公司 Data transmission method and data transmission device
CN110795674B (en) * 2019-10-30 2022-08-09 恩亿科(北京)数据科技有限公司 Configuration updating method and device
CN111506786B (en) * 2020-03-06 2023-10-27 百度在线网络技术(北京)有限公司 Method, device, electronic equipment and computer readable storage medium for web page update

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101741986A (en) * 2009-12-31 2010-06-16 优视科技有限公司 Page cache method for mobile communication equipment terminal
CN102724297A (en) * 2012-05-25 2012-10-10 上海传漾网络科技有限公司 Method for increasing access speed in browser/server (BS) architecture advertisement management system
CN103428188A (en) * 2012-05-25 2013-12-04 北京小米科技有限责任公司 Method and apparatus for file updating, and associated equipment
CN103678330A (en) * 2012-09-04 2014-03-26 北京新岸线移动多媒体技术有限公司 Method, system and device for loading webpage data

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6912591B2 (en) * 2001-05-02 2005-06-28 Science Application International Corporation System and method for patch enabled data transmissions
US7509635B2 (en) * 2003-09-26 2009-03-24 Red Hat, Inc. Software and data file updating process
CN102253941A (en) * 2010-05-21 2011-11-23 卓望数码技术(深圳)有限公司 Cache updating method and cache updating device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101741986A (en) * 2009-12-31 2010-06-16 优视科技有限公司 Page cache method for mobile communication equipment terminal
CN102724297A (en) * 2012-05-25 2012-10-10 上海传漾网络科技有限公司 Method for increasing access speed in browser/server (BS) architecture advertisement management system
CN103428188A (en) * 2012-05-25 2013-12-04 北京小米科技有限责任公司 Method and apparatus for file updating, and associated equipment
CN103678330A (en) * 2012-09-04 2014-03-26 北京新岸线移动多媒体技术有限公司 Method, system and device for loading webpage data

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109948087A (en) * 2017-12-05 2019-06-28 广东欧珀移动通信有限公司 Acquisition methods, device and the terminal of web page resources
CN110362333A (en) * 2019-06-29 2019-10-22 上海淇馥信息技术有限公司 A kind of quick solution, device and electronic equipment that client upgrading hinders
CN113010811A (en) * 2019-12-20 2021-06-22 北京百度网讯科技有限公司 Webpage acquisition method and device, electronic equipment and computer readable storage medium
CN113010811B (en) * 2019-12-20 2024-03-26 北京百度网讯科技有限公司 Webpage acquisition method and device, electronic equipment and computer readable storage medium
CN112817700A (en) * 2021-02-25 2021-05-18 北京顶象技术有限公司 Method and device for realizing active updating of client script and computer equipment
CN113472888A (en) * 2021-07-07 2021-10-01 挂号网(杭州)科技有限公司 Webpage access method, device, server equipment and storage medium
CN113472888B (en) * 2021-07-07 2024-01-05 挂号网(杭州)科技有限公司 Webpage access method and device, server equipment and storage medium

Also Published As

Publication number Publication date
CN105095226A (en) 2015-11-25
CN105095226B (en) 2019-08-02

Similar Documents

Publication Publication Date Title
WO2015161658A1 (en) Webpage resource loading method and device
CN110263275B (en) Method and device for accessing webpage, mobile terminal and storage medium
CN110019350B (en) Data query method and device based on configuration information
US9077681B2 (en) Page loading optimization using page-maintained cache
CN105930528B (en) Webpage caching method and server
WO2017113060A1 (en) Website access method and device, and website system
US8527862B2 (en) Methods for making ajax web applications bookmarkable and crawlable and devices thereof
US10146750B2 (en) Method, apparatus, terminal, and storage medium for image processing
WO2015074467A1 (en) Data update method, apparatus, and system and storage medium
WO2016026384A1 (en) Client page display method, device and system
WO2018001124A1 (en) Webpage file sending method, webpage rendering method and apparatus, and webpage rendering system
US9088462B2 (en) Common web accessible data store for client side page processing
US11080322B2 (en) Search methods, servers, and systems
CN104572843A (en) Page loading method and device
CN105468707A (en) Cache-based data processing method and device
CN106354792B (en) Webpage display method and device
US10129363B2 (en) Plug-in cache
CN111783005B (en) Method, device and system for displaying web page, computer system and medium
CN107229655B (en) Updating method, device and system of page static file
CN109002557B (en) Method and electronic equipment for optimizing webpage loading speed based on browser caching mechanism
US20160224553A1 (en) Search methods and terminals
CN103793459B (en) Webpage opening method and device
CN106777055B (en) Method and device for realizing website interfacing rendering
WO2016150017A1 (en) Page display method, device, system and non-volatile computer storage medium
US9282159B2 (en) System and method for providing a proxy with a browser cache and a native cache

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: 14890418

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: 14890418

Country of ref document: EP

Kind code of ref document: A1