CN107656934B - Preloading method, device and equipment - Google Patents
Preloading method, device and equipment Download PDFInfo
- Publication number
- CN107656934B CN107656934B CN201610590423.2A CN201610590423A CN107656934B CN 107656934 B CN107656934 B CN 107656934B CN 201610590423 A CN201610590423 A CN 201610590423A CN 107656934 B CN107656934 B CN 107656934B
- Authority
- CN
- China
- Prior art keywords
- webpage
- displayed
- sub
- resource
- response head
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 70
- 230000004044 response Effects 0.000 claims abstract description 247
- 230000005540 biological transmission Effects 0.000 claims abstract description 9
- 230000008569 process Effects 0.000 claims description 27
- 238000004891 communication Methods 0.000 claims description 19
- 230000036316 preload Effects 0.000 claims 2
- 238000010586 diagram Methods 0.000 description 9
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000003993 interaction Effects 0.000 description 3
- 238000012546 transfer Methods 0.000 description 3
- 238000003912 environmental pollution Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
- G06F16/9574—Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/955—Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
- G06F16/9566—URL specific, e.g. using aliases, detecting broken or misspelled links
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The embodiment of the invention discloses a preloading method, which comprises the following steps: sending an access request to a webpage server, wherein the access request comprises a domain name of a webpage to be displayed; acquiring protocol response data corresponding to the domain name from local, wherein the protocol response data comprises a domain name list of at least one sub-resource of the webpage to be displayed; establishing a Transmission Control Protocol (TCP) connection of each sub-resource according to the domain name list of the at least one sub-resource; receiving webpage data of the webpage to be displayed, which is sent by the webpage server, wherein the webpage data comprises main resources of the webpage to be displayed; loading the main resource of the webpage to be displayed; and loading the sub-resources of the webpage to be displayed according to the TCP connection to form the webpage to be displayed. Further, the embodiment of the invention also provides a preloading device and equipment.
Description
Technical Field
The present invention relates to information processing technologies, and in particular, to a preloading method, apparatus, and device.
Background
With the development of the internet, websites serve as new media to provide news, entertainment and learning materials for people, so that users often use browsers to access various webpages of various websites during entertainment or work.
In the prior art, when a user accesses a certain web page of a website through a browser, the browser first sends an access request to a website server, where the access request includes a domain name of the web page to be accessed. And the website server sends the main resource of the webpage corresponding to the domain name included in the access request to the browser, and after the browser completes the response of the main resource, the website server sends the sub-resource of the webpage corresponding to the domain name included in the access request to the browser, so that the browser can fill the sub-resource in the corresponding position of the main resource. And after the main resource and the sub-resource respond, the browser displays the webpage, so that the user can watch the webpage conveniently.
However, by adopting the above method, the browser needs to download and run the resources respectively, and the page display cannot be completed until all the relevant resources are loaded, and usually, the time required by the user from triggering the link of the page to seeing the complete page corresponding to the link is long, generally exceeding 10 seconds, and if the website code to be accessed by the user is unreasonable in design, the waiting time is long, so that the page loading time is too long, the access speed is low, and the user experience is poor.
Disclosure of Invention
In order to solve the technical problem, embodiments of the present invention desirably provide a preloading method, apparatus, and device, which can improve the opening speed of a web page, thereby improving user experience.
The technical scheme of the invention is realized as follows:
in a first aspect, an embodiment of the present invention provides a preloading method, including:
sending an access request to a webpage server, wherein the access request comprises a domain name of a webpage to be displayed;
acquiring protocol response data corresponding to the domain name from local, wherein the protocol response data comprises a domain name list of at least one sub-resource of the webpage to be displayed; establishing a Transmission Control Protocol (TCP) connection of each sub-resource according to the domain name list of the at least one sub-resource;
receiving webpage data of the webpage to be displayed, which is sent by the webpage server, wherein the webpage data comprises main resources of the webpage to be displayed;
loading the main resource of the webpage to be displayed; and loading the sub-resources of the webpage to be displayed according to the TCP connection to form the webpage to be displayed.
In a second aspect, an embodiment of the present invention provides a preloading device, including:
the device comprises a sending unit, a display unit and a display unit, wherein the sending unit is used for sending an access request to a webpage server, and the access request comprises a domain name of a webpage to be displayed;
the establishing unit is used for locally acquiring protocol response data corresponding to the domain name, and the protocol response data comprises a domain name list of at least one sub-resource of the webpage to be displayed; establishing a Transmission Control Protocol (TCP) connection of each sub-resource according to the domain name list of the at least one sub-resource;
the receiving unit is used for receiving webpage data of the webpage to be displayed, which are sent by the webpage server, wherein the webpage data comprise main resources of the webpage to be displayed;
the loading unit is used for loading the main resource of the webpage to be displayed; and loading the sub-resources of the webpage to be displayed according to the TCP connection to form the webpage to be displayed.
In a third aspect, an embodiment of the present invention provides a preloading device, where the device includes a communication interface and a processor:
the processor is used for sending an access request to a webpage server through the communication interface, wherein the access request comprises a domain name of a webpage to be displayed; acquiring protocol response data corresponding to the domain name from local, wherein the protocol response data comprises a domain name list of at least one sub-resource of the webpage to be displayed; establishing a Transmission Control Protocol (TCP) connection of each sub-resource according to the domain name list of the at least one sub-resource; receiving webpage data of the webpage to be displayed, which is sent by the webpage server, through the communication interface, wherein the webpage data comprises main resources of the webpage to be displayed; loading the main resource of the webpage to be displayed; and loading the sub-resources of the webpage to be displayed according to the TCP connection to form the webpage to be displayed.
Compared with the prior art, when a user accesses a webpage through a browser, the browser captures main resources of the webpage and waits for the idle time of main resource response, sub-resources of the webpage can be actively captured according to pre-stored protocol response data and TCP connection is established, the sub-resources do not need to be captured after the browser responds to the main resources, and the capturing of the sub-resources by the browser is saved; and the time consumption for establishing the TCP connection is reduced, so that the opening speed of the webpage is improved.
Drawings
FIG. 1 is a schematic diagram of an implementation environment in accordance with an embodiment of the present invention;
fig. 2 is a first schematic flow chart illustrating an implementation process of a preloading method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of an implementation flow of a preloading method according to an embodiment of the present invention;
fig. 4 is a schematic flow chart illustrating an implementation process of a preloading method according to an embodiment of the present invention;
fig. 5 is a schematic flow chart of an implementation of a preloading method according to an embodiment of the present invention;
FIG. 6-1 is a first interaction diagram of a preloading method according to an embodiment of the present invention;
fig. 6-2 is an interaction diagram of a preloading method according to an embodiment of the present invention;
FIG. 7 is a first structural diagram of a preloading device according to an embodiment of the present invention;
fig. 8 is a second schematic structural diagram of a preloading device according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of a preloading device provided in the embodiment of the present invention;
fig. 10 is a schematic structural diagram of a preloading device according to an embodiment of the present invention.
Detailed Description
In order to solve the problems in the background art, embodiments of the present invention provide a preloading method, which can be applied to a terminal, such as a computer, a mobile phone, a tablet computer, and the like, that is installed with a browser and can browse a web page through the browser. Fig. 1 is a schematic diagram of an implementation environment when the method is applied to a mobile phone, where the mobile phone is installed with a browser, and as shown in fig. 1, the implementation environment includes: the mobile phone 11 and the web server 12 arranged on the network side are connected, the mobile phone 11 and the web server 12 are connected through a wireless network or a wired network, the web server 12 can send web data to the mobile phone 11 according to a request of the mobile phone 11, so that a browser installed in the mobile phone 11 can display a web page required to be browsed by a user according to the web page data, and the web page data comprises main resources and sub resources of the web page.
The technical solution of the present invention is further elaborated below with reference to the drawings and the specific embodiments.
An embodiment of the present invention provides a preloading method, as shown in fig. 2, the method includes:
For example, when a user needs to access a web page, a browser on a terminal may be opened, then a domain name of the web page to be accessed is input in an address bar of the browser and click to determine, at this time, the browser sends an access request to a web server corresponding to the web page, the access request carries the domain name of the web page to be accessed by the user, and the web page to be accessed by the user is the web page to be displayed by the browser.
Or, usually, some pictures or texts are displayed on the current page of the browser, the pictures or texts are linked with a secondary page, when a user wants to access the secondary page linked with the pictures or texts, the user can click the pictures or texts, at this time, the browser sends an access request to a web server corresponding to the secondary page, the access request carries a domain name of the secondary page, and the secondary page is a web page to be displayed of the browser.
Here, step S202 may be executed in a process of waiting for the web server to return the web data of the web page to be displayed according to the domain name, and since the web server may only send the main resource of the web page to be displayed to the terminal, and does not send the protocol response data, traffic consumption of the terminal is reduced; because the terminal can not receive the protocol response data from the webpage server, the terminal can establish the TCP connection according to the protocol response data acquired from the local part in the waiting process, so that the time consumption for establishing the TCP connection is reduced, and the webpage opening speed is improved.
For example, after the browser sends an access request to the web server, the browser may continuously perform step 2021 and step 2022 while waiting for the web server to return the web data of the web page to be displayed according to the domain name, where the performing processes of step 2021 and step 2022 are described in detail below.
Step 2021, the browser queries the protocol response data of the web page to be displayed from the locally stored information.
In this embodiment, the protocol response data may be stored in the cache of the browser, or may be stored in a memory of a terminal where the browser is installed.
In the process of waiting for the web page server to return the web page data of the web page to be displayed according to the domain name, the browser may first obtain the protocol response data from a local cache or a memory. The protocol response data comprises a domain name list of at least one sub-resource of the webpage to be displayed, and the domain name list of each sub-resource comprises a domain name, a protocol identifier and a port identifier. The sub-resources of the web page are usually information such as pictures or videos, which are stored in different servers in the network, the communication protocols corresponding to different servers may be different, and the port numbers used when different servers are connected to the browser may also be different, so the domain name list of each sub-resource includes the corresponding domain name, protocol identifier and port identifier, where the domain name is used to indicate the address of the server storing the sub-resource; the protocol identification is used for indicating a communication protocol between the browser and the server for storing the sub-resources; and the port identifier is used for indicating a port number between a terminal for installing the browser and a server for storing the sub-resources.
Illustratively, the main resource is an HTML (hypertext Markup Language) file in the web page data, and the sub-resources are any js (javascript)/CSS (Cascading Style Sheets)/picture other than the main resource in the web page data.
Step 2022, the browser establishes a TCP connection for each of the multiple sub-resources according to the domain name list of the multiple sub-resources included in the protocol response data.
For example, the browser may first perform DNS (Domain Name System) resolution on a Domain Name list of the child resource to obtain an IP (Internet Protocol) address of a server storing the child resource, and then establish a TCP connection between the IP address of the server storing the child resource and the browser according to a Protocol identifier and a port identifier corresponding to the child resource.
Assuming that protocol response data of a webpage to be displayed comprises a domain name list of 3 sub-resources, after a browser obtains the domain name list of the three sub-resources, firstly performing DNS (domain name system) analysis on the domain name list of the three sub-resources to respectively obtain an IP address of a server for storing the first sub-resource, an IP address of a server for storing the second sub-resource and an IP address of a server for storing the third sub-resource, wherein the IP address of the server for storing the first sub-resource is the IP address of the server for storing the first sub-resource, the IP address of the server for storing the second sub-resource is the IP address of the server for storing the second sub-resource, the IP address of the server for storing the third sub-resource is the IP address of the server for storing the third sub-resource, and then obtaining a communication protocol between the server for storing the first sub-resource and the browser and a communication between the terminal for installing the browser according to a protocol identifier and a port identifier in the domain name list of the first sub-resource According to the communication protocol and the port number, establishing TCP connection between the server storing the first sub-resource and the browser; similarly, according to the protocol identifier and the port identifier in the domain name list of the second sub-resource and the third sub-resource, the communication protocol between the server storing the second sub-resource and the third sub-resource and the browser and the port number for communicating with the terminal where the browser is installed are respectively obtained, and then the TCP connection between the server storing the second sub-resource and the browser and the TCP connection between the server storing the third sub-resource and the browser are established.
For example, after the browser sends an access request to the web server, the web server may obtain the web data of the web page to be displayed according to the domain name in the access request, because the terminal where the browser is installed stores protocol response data describing the sub-resources of the web page to be displayed, that is, the browser may not need to obtain the relevant information of the sub-resources of the web page to be displayed again from the web server, at this time, the web data sent by the web server may only include the main resource of the web page to be displayed.
Or the webpage data sent by the webpage server can also comprise protocol response data describing the sub-resources of the webpage to be displayed besides the main resources of the webpage to be displayed, so that the terminal or the browser can update the stored protocol response data.
And 204, loading the main resource of the webpage to be displayed and loading the sub-resource of the webpage to be displayed according to the TCP connection to form the webpage to be displayed.
Exemplarily, after the browser receives the main resource of the webpage to be displayed, the main resource of the webpage to be displayed is loaded to form a frame of the webpage to be displayed, the sub-resources are loaded according to the TCP connection of each sub-resource while the main resource of the webpage to be displayed is loaded, and the loaded sub-resources are filled in the frame of the webpage to be displayed to form the webpage to be displayed.
The method comprises the steps that a webpage to be displayed is assumed to be a video page, the page comprises a main video and pictures for linking other related videos, the layout of the whole video page is set by taking the webpage to be displayed as a main resource, and the pictures of the main video and the other related videos are sub-resources of the webpage to be displayed. In the process of loading the main resource, the browser can load the sub-resources simultaneously, namely, the obtained main video is loaded to the main video playing area set by the main resource, and the obtained picture is loaded to the display area of the related video picture set by the main resource. And forming a complete video page after the browser finishes loading the main resource and the sub-resources.
In other embodiments of the present invention, a general web Protocol is HTTP (Hyper Text Transfer Protocol), and in the communication Protocol, after a TCP connection is established between the browser and the server storing the sub-resources, the sub-resources can be added to form a complete web page. However, some web pages have network protocols of HTTPS (Hyper Text Transfer Protocol over Secure Socket Layer, a hypertext Transfer Protocol based on a Secure data Layer), after TCP connection is established between the browser and the server storing the sub-resources, the browser is required to perform SSL (Secure Sockets Layer) handshake on the TCP connection of each sub-resource, and when the SSL handshake of the TCP connection of each sub-resource is successful, the browser can load the main resource of the web page to be displayed and load the sub-resource of the web page to be displayed according to the TCP connection, so as to form a complete web page to be displayed; if the child resource which is not successfully connected with the TCP and SSL handshake exists, the browser cannot load the child resource, and at the moment, the area corresponding to the child resource in the webpage to be displayed is blank or the identifier of unsuccessful loading is displayed.
An embodiment of the present invention provides a preloading method, as shown in fig. 3, the method includes:
For example, after the browser sends an access request to the web server, in the process of waiting for the web server to return the web data of the web page to be displayed according to the domain name, the browser may continuously perform steps 302 to 304, and the execution process of steps 302 to 304 is described in detail below.
In this embodiment, the protocol response data may be stored in the cache of the browser, or may be stored in a memory of a terminal where the browser is installed.
In the process of waiting for the web page server to return the web page data of the web page to be displayed according to the domain name, the browser may first obtain the protocol response data from a local cache or a memory. The protocol response data comprises a domain name list of at least one sub-resource of the webpage to be displayed and a time threshold, the domain name list of each sub-resource comprises a domain name, a protocol identifier and a port identifier, and the time threshold is used for indicating the longest time limit of the protocol response data stored in the terminal.
In practical applications, each web page is not constant, and an administrator may update the web page regularly, modify an error on the web page, or update content on the web page, so that protocol response data stored at the terminal side may not match the current main resource of the web page, and if a sub-resource corresponding to the protocol response data stored at the terminal is filled in the current main resource of the web page, a situation of incomplete display or an error of the web page may occur, which may affect viewing of a user.
To avoid this, the protocol response data further includes a time threshold for indicating the maximum time limit for storage, which may be the same as the period for which the administrator updates the web page. After the browser acquires the locally stored protocol response data, it may first determine whether the storage duration of the protocol response data is less than or equal to a time threshold. If the storage duration of the protocol response data in the terminal is greater than the time threshold, the webpage data may have been updated by the administrator at the moment, and the protocol response data stored in the terminal is invalid; if the storage duration of the protocol response data in the terminal is less than or equal to the time threshold, it indicates that the administrator does not modify the web page data in the time period from the time when the terminal stores the protocol response data to the current time, and the protocol response data stored in the terminal is still valid.
Illustratively, if the storage duration of the protocol response data is less than or equal to the time threshold, which indicates that the protocol response data locally stored by the current terminal is still valid, the domain name list of the plurality of sub-resources included in the protocol response data may be obtained, and a TCP connection of each sub-resource may be established.
Specifically, the browser may first perform DNS resolution on the domain name list of the child resource to obtain an IP address of the server storing the child resource, and then establish TCP connection between the IP address of the server storing the child resource and the browser according to the protocol identifier and the port identifier corresponding to the child resource.
Illustratively, if the storage duration of the protocol response data locally stored in the terminal at the terminal is greater than the time threshold, it indicates that the administrator may have updated the web page data at this time, the protocol response data stored in the terminal is invalid, and the browser cannot load the sub-resource corresponding to the protocol response data locally stored to form the web page to be displayed, and at this time, may wait to receive the web page data of the web page to be displayed sent by the web page server, and obtain the protocol response data in the web page data sent by the web page server, where the protocol response data is the latest protocol response data after the web page is updated and is matched with the main resource of the current web page.
And 307, loading the main resource of the webpage to be displayed and loading the sub-resource of the webpage to be displayed according to the TCP connection to form the webpage to be displayed.
Exemplarily, after the browser receives the main resource of the webpage to be displayed, the main resource of the webpage to be displayed is loaded to form a frame of the webpage to be displayed, the sub-resources are loaded according to the TCP connection of each sub-resource while the main resource of the webpage to be displayed is loaded, and the loaded sub-resources are filled in the frame of the webpage to be displayed to form the webpage to be displayed.
In other embodiments of the present invention, if the network protocol of the web page is HTTPS, after a TCP connection is established between the browser and the server storing the sub-resources, the browser is further required to perform SSL handshake on the TCP connection of each sub-resource, and when the SSL handshake of the TCP connection of each sub-resource is successful, the browser can load the main resource of the web page to be displayed and load the sub-resources of the web page to be displayed according to the TCP connection, thereby finally forming a complete web page to be displayed.
An embodiment of the present invention provides a preloading method, as shown in fig. 4, the method includes:
For example, after the browser sends an access request to the web server, in the process of waiting for the web server to return the web data of the web page to be displayed according to the domain name, the browser may continuously perform steps 402 to 404, and the execution process of steps 402 to 404 is described in detail below.
In practice, each web page is not constant, and the administrator may update the web page periodically, modify an error on the web page, or update the content on the web page, so the protocol response data may further include a time threshold indicating the maximum time limit for storing, and the time threshold may be the same as the update cycle for updating the web page by the administrator. After the browser acquires the locally stored protocol response data, it may first determine whether the storage duration of the protocol response data is less than or equal to a time threshold.
Illustratively, if the storage duration of the protocol response data is less than or equal to the time threshold, it indicates that, in a time period from the time when the terminal stores the protocol response data to the current time, the administrator does not modify the web page data, and the protocol response data locally stored by the terminal is still valid, the domain name list of the plurality of sub-resources included in the protocol response data may be obtained, and the TCP connection of each sub-resource may be established.
Specifically, the browser may first perform DNS resolution on the domain name list of the child resource to obtain an IP address of the server storing the child resource, and then establish TCP connection between the IP address of the server storing the child resource and the browser according to the protocol identifier and the port identifier corresponding to the child resource.
Illustratively, if the storage duration of the protocol response data locally stored in the terminal at the terminal is greater than the time threshold, it indicates that the administrator may have updated the web page data at this time, the protocol response data stored in the terminal is invalid, and the browser cannot load the sub-resource corresponding to the protocol response data locally stored to form the web page to be displayed, and at this time, may wait to receive the web page data of the web page to be displayed sent by the web page server, and obtain the protocol response data in the web page data sent by the web page server, where the protocol response data is the latest protocol response data after the web page is updated and is matched with the main resource of the current web page.
Illustratively, after the latest protocol response data is acquired, the locally stored protocol response data may be updated by using the latest protocol response data, that is, the protocol response data of the webpage to be displayed in the received webpage data, so that the protocol response data locally stored in the terminal when the webpage is accessed next time can be matched with the main resource of the webpage, and the time for loading the webpage by the browser is saved.
After the updating is completed, the browser can establish a TCP connection for each sub-resource according to the domain name list of the plurality of sub-resources included in the updated protocol response data, so as to form the web page to be displayed.
And 407, loading the main resource of the webpage to be displayed and loading the sub-resource of the webpage to be displayed according to the TCP connection to form the webpage to be displayed.
Illustratively, the browser loads the main resource of the webpage to be displayed to form a frame of the webpage to be displayed, loads the sub-resources according to the TCP connection of each sub-resource while loading the main resource of the webpage to be displayed, and fills the loaded sub-resources in the frame of the webpage to be displayed to form the webpage to be displayed.
In other embodiments of the present invention, if the network protocol of the web page is HTTPS, after a TCP connection is established between the browser and the server storing the sub-resources, the browser is further required to perform SSL handshake on the TCP connection of each sub-resource, and when the SSL handshake of the TCP connection of each sub-resource is successful, the browser can load the main resource of the web page to be displayed and load the sub-resources of the web page to be displayed according to the TCP connection, thereby finally forming a complete web page to be displayed.
An embodiment of the present invention provides a preloading method, as shown in fig. 5, the method includes:
For example, after the browser sends an access request to the web server, in the process of waiting for the web server to return the web data of the web page to be displayed according to the domain name, the browser may continuously perform steps 502 to 504, and the execution process of steps 502 to 504 is described in detail below.
In practice, each web page is not constant, and the administrator may update the web page periodically, modify an error on the web page, or update the content on the web page, so the protocol response data may further include a time threshold indicating the maximum time limit for storing, which may be the same as the period for which the administrator updates the web page. After the browser acquires the locally stored protocol response data, it may first determine whether the storage duration of the protocol response data is less than or equal to a time threshold.
Illustratively, if the storage duration of the protocol response data is less than or equal to the time threshold, it indicates that, in a time period from the time when the terminal stores the protocol response data to the current time, the administrator does not modify the web page data, and the protocol response data locally stored by the terminal is still valid, the domain name list of the plurality of sub-resources included in the protocol response data may be obtained, and the TCP connection of each sub-resource may be established.
Specifically, the browser may first perform DNS resolution on the domain name list of the child resource to obtain an IP address of the server storing the child resource, and then establish TCP connection between the IP address of the server storing the child resource and the browser according to the protocol identifier and the port identifier corresponding to the child resource.
Illustratively, if the storage duration of the protocol response data locally stored in the terminal at the terminal is greater than the time threshold, which indicates that the administrator may have updated the web page data at this time, the protocol response data stored in the terminal is invalid, and the sub-resource corresponding to the protocol response data locally stored cannot be loaded to form the web page to be displayed, at this time, the administrator may wait to receive the web page data of the web page to be displayed sent by the web page server, and acquire the protocol response data in the web page data sent by the web page server, where the protocol response data is the latest updated protocol response data and is matched with the main resource of the current web page.
Illustratively, whether the protocol response data stored in the terminal is valid is determined by the storage time length of the protocol response data stored in the terminal, and if the storage time length exceeds a time threshold, the terminal considers that the protocol response data stored locally is invalid and needs to be updated; if the storage duration is within the time threshold, the terminal considers that the locally stored protocol response data is valid and does not need to be updated. However, the administrator does not update the web page every update period, and if the administrator does not update the web page data in the current update period, the protocol response data in the web page data received by the terminal is the same as the protocol response data stored locally, and at this time, the updating may not be needed. In order to avoid the waste of processing resources caused by the fact that the terminal replaces locally stored protocol response data with the same protocol response data, before updating, the browser can also determine whether the protocol response data included in the webpage data is the same as the locally stored protocol response data.
Illustratively, if the protocol response data included in the web page data is different from the locally stored protocol response data, which indicates that the administrator has indeed modified and updated the web page data in the update period, at this time, the terminal may update the locally stored protocol response data according to the protocol response data included in the web page data, so that the locally stored protocol response data of the terminal can be matched with the main resource of the web page when the terminal accesses the web page next time, and the time for the browser to load the web page is saved.
After the updating is completed, the browser can establish a TCP connection for each sub-resource according to the domain name list of the plurality of sub-resources included in the updated protocol response data, so as to form the web page to be displayed.
Illustratively, if the protocol response data included in the web page data is the same as the locally stored protocol response data, it indicates that the administrator does not modify and update the web page data in the current update period, at this time, the terminal does not update the locally stored protocol response data, but updates the timer for recording the storage time of the protocol response data, and clears the timer, so as to record the storage time of the protocol response data again. After the timer is cleared, the browser may establish a TCP connection for each sub-resource according to a domain name list of a plurality of sub-resources included in the locally stored protocol response data, so as to form the web page to be displayed.
Illustratively, the browser loads the main resource of the webpage to be displayed to form a frame of the webpage to be displayed, loads the sub-resources according to the TCP connection of each sub-resource while loading the main resource of the webpage to be displayed, and fills the loaded sub-resources in the frame of the webpage to be displayed to form the webpage to be displayed.
In other embodiments of the present invention, if the network protocol of the web page is HTTPS, after a TCP connection is established between the browser and the server storing the sub-resources, the browser is further required to perform SSL handshake on the TCP connection of each sub-resource, and when the SSL handshake of the TCP connection of each sub-resource is successful, the browser can load the main resource of the web page to be displayed and load the sub-resources of the web page to be displayed according to the TCP connection, thereby finally forming a complete web page to be displayed.
The embodiment of the invention provides a preloading method, which is applied to a webpage server and a terminal provided with a browser, wherein the browser is used as a client to independently operate with the terminal, so that the browser can be used as an execution subject to complete all steps related to the preloading method, and the preloading method for interaction between the browser and the webpage server is explained in detail below. As shown in fig. 6-1, the method includes:
Exemplarily, when a user can open a browser on a terminal, input a domain name of a webpage to be accessed in an address bar of the browser and click to determine, the browser sends an access request to a webpage server corresponding to the webpage, where the access request carries the domain name of the webpage to be accessed by the user, and the webpage to be accessed by the user is a webpage to be displayed by the browser. For example, when a user wants to access Web news, the user may enter "http:// news.163. com/" in the address bar of the browser, and click certain, the browser will send an access request including the domain name "http:// news.163. com/" to the Web server of the Web news.
Or, when a user wants to access a secondary page linked with a picture or text displayed on a current page, the user can click the picture or text, and at this time, the browser sends an access request to a web server corresponding to the secondary page, wherein the access request carries a domain name of the secondary page, and the secondary page is a web page to be displayed of the browser. For example, suppose an internet news page shows an environmental pollution picture linking a secondary page related to the environmental pollution news with a domain name of "http:// news.163.com/16/0708/10/BREQAAVU00014JB6. html", and when the user wants to access the secondary page, he can click on the picture, and the browser sends an access request including the domain name "http:// news.163.com/16/0708/10/BREQAAVU00014JB6. html" to the web server of the internet news.
For example, after receiving an access request sent by a browser, a web server may obtain web data of a web page to be displayed according to a domain name in the access request, where the web data includes a main resource that may be HTTP response data, and the protocol response data may be an HTTP response header.
In other embodiments of the present invention, when returning HTTP response data corresponding to a web page to be displayed, a web server may actively set an x-pre-connect header, where the x-pre-connect is an HTTP response header customized by the embodiment of the present invention and is used to transmit protocol response data, and a format of the x-pre-connect is as follows:
x-pre-connect:max-age=expireTime;[scheme://]domain[:port][,[scheme://]domain[:port]];
wherein, max-age is a time threshold value, the unit is second, and the max-age is used for indicating the longest time limit for storing x-pre-connect by the terminal; the [ scheme:// ] domain [: port ] represents a domain name list of a sub-resource, different sub-resource domain name lists are separated by commas, and the x-pre-connect at least comprises a domain name list of a sub-resource; the scheme in each domain name list [ scheme:// ] domain [: port ] is a protocol identifier for indicating a communication protocol between the browser and the server storing the sub-resource, for example, the scheme may be HTTP or HTTPs, and if there is no scheme in x-pre-connect, the communication protocol is default to HTTP; the domain is a domain name and indicates the address of a server storing the child resources; and the port is a port identifier and is used for indicating a port number between a terminal for installing the browser and a server for storing the sub-resources, if the scheme is HTTP, the port number is defaulted to 80, and if the scheme is HTTPS, the port number is fixed to 443.
Illustratively, the web page server sets a custom x-pre-connect header as an HTTP response header, and then transmits the set HTTP response data to the browser, so that the browser forms a web page to be displayed according to the HTTP response data.
Illustratively, after receiving HTTP response data sent by a web server, a browser acquires an x-pre-connect header, and stores the x-pre-connect header in a local according to a domain name of the web page to be displayed, so that when the browser accesses the web page to be displayed again, the browser can query the x-pre-connect header corresponding to the web page to be displayed from locally stored information according to the domain name of the web page to be displayed, and set a timer locally, and set a max-age in the x-pre-connect to a maximum value of the timer.
It should be noted that the x-pre-connect may be stored in the cache of the browser, or may be stored in a memory of a terminal in which the browser is installed.
For example, when the user needs to access the web page to be displayed again, the browser may send an access request to the web page server again.
For example, in the process of waiting for the web page server to return the web page data of the web page to be displayed according to the domain name, the browser may first query, in the local cache, an x-pre-connect stored in the domain name of the web page to be displayed according to the domain name of the web page to be displayed, where the x-pre-connect is protocol response data of the web page to be displayed.
Step 607, the browser determines whether the storage duration of the protocol response data is less than or equal to a time threshold; if the storage duration of the protocol response data is less than or equal to the time threshold, execute step 608; if the storage duration of the protocol response data is greater than the time threshold, step 609 is executed.
In practical applications, each web page is not constant, and an administrator may update the web page regularly, modify an error on the web page, or update content on the web page, so that protocol response data stored at the terminal side may not match the current main resource of the web page, and if a sub-resource corresponding to the protocol response data stored at the terminal is filled in the current main resource of the web page, a situation of incomplete display or an error of the web page may occur, which may affect viewing of a user.
In order to avoid the foregoing situation, after the browser acquires the locally stored x-pre-connection of the web page to be displayed, it may first determine whether the storage duration of the x-pre-connection is less than or equal to max-age in the x-pre-connection, and specifically, may determine by using a timer locally set in the terminal. If the storage time of the x-pre-connection in the terminal is longer than the max-age, the fact that the web page data may be updated by the administrator at the moment is shown, and the x-pre-connection stored in the terminal is invalid; if the storage duration of the x-pre-connection in the terminal is less than or equal to the max-age, it indicates that the administrator does not modify the web page data in the time period from the time when the terminal stores the x-pre-connection to the current time, and the x-pre-connection stored in the terminal is still valid.
Illustratively, if the storage duration of the x-pre-connection is less than or equal to the max-age, the browser may obtain a domain name list [ scheme:// ] domain [: port ] of a plurality of sub-resources included in the x-pre-connection, and establish a TCP connection for each sub-resource.
Specifically, the browser can firstly perform DNS analysis on the domain name list [ scheme:// ] domain [: port ] of the sub-resource to obtain the IP address corresponding to the domain in the domain name list [ scheme:// ] domain [: port ] of the sub-resource, and then establish TCP connection between the IP address of the server storing the sub-resource and the browser according to the scheme and the port in the domain name list [ scheme:// ] domain:/: port ] corresponding to the sub-resource.
Illustratively, if the storage duration of the x-pre-connect locally stored by the terminal is longer than the max-age, which indicates that the administrator may have updated the web page data at this time, the x-pre-connect stored by the terminal is invalid, and the browser cannot load the locally stored x-pre-connect to form the web page to be displayed, at this time, it may wait to receive the web page data of the web page to be displayed sent again by the web page server and obtain the HTTP response data sent by the web page server, and obtain the x-pre-connect in the HTTP response data, where the x-pre-connect is the latest x-pre-connect after updating the web page and matches with the main resource of the current web page.
After receiving the access request sent by the browser again, the web server may obtain the web data of the web page to be displayed again according to the domain name in the access request, and send the web data to the browser.
Illustratively, after the latest x-pre-contact is obtained, the x-pre-contact locally stored by the terminal can be updated by using the latest x-pre-contact, so that the x-pre-contact locally stored by the terminal can be matched with the main resource of the webpage when the webpage to be displayed is accessed by the browser next time, and the time for loading the webpage by the browser is saved.
After the updating is completed, the browser can establish a TCP connection of each sub-resource according to a domain name list [ scheme:/] domain [: port ] of a plurality of sub-resources included in the updated x-pre-connect.
Illustratively, the browser loads the main resource of the webpage to be displayed to form a frame of the webpage to be displayed, loads the sub-resources according to the TCP connection of each sub-resource while loading the main resource of the webpage to be displayed, and fills the loaded sub-resources in the frame of the webpage to be displayed to form the webpage to be displayed.
In other embodiments of the present invention, if the network protocol of the web page is HTTPS, after a TCP connection is established between the browser and the server storing the sub-resources, the browser is further required to perform SSL handshake on the TCP connection of each sub-resource, and when the SSL handshake of the TCP connection of each sub-resource is successful, the browser can load the main resource of the web page to be displayed and load the sub-resources of the web page to be displayed according to the TCP connection, thereby finally forming a complete web page to be displayed.
The embodiment of the invention can also be applied between the browser and the web server, and can be effective only by the support of both parties. The protocol data transmitted between the web server and the browser in the embodiment of the invention depends on the self-defined HTTP response head x-pre-connect. The format of the x-pre-connect is as follows:
max-age expireTime; [ scheme:// ] domain [: port ], [ scheme:// ] domain [: port ] ], where [ scheme:// ] domain [: port ] identifies a list of domain names for a sub-resource.
Specifically, as shown in FIG. 6-2, the example of the user accessing http:// example. com is illustrated, wherein the domain name list [ scheme:// ] domain [: port ] in the x-pre-connect is replaced by a.example. com:
and 6A, accessing http:// example.com by the user, namely inputting an address in an address bar of a browser or clicking connection on a page by the user.
And 6B, the browser sends the request to the web server.
Step 6C, web the server sets the response header of the HTTP response to x-pre-connect when returning the HTTP response data corresponding to the primary resource.
And 6D, the browser acquires the x-pre-connect and caches the x-pre-connect by taking the example.com as an identifier.
And 6E, the browser analyzes the domain name list a.example.com in the x-pre-connect and establishes TCP connection.
And 6F, the browser loads sub-resources of the web page http:// example.com according to the TCP connection, forms the web page and displays the web page.
Com webpage is accessed again by the user, step 6H.
And 6I, the browser firstly initiates a main resource request and immediately takes out a domain name list corresponding to the x-pre-connect from the cache.
And 6J, if the domain name list is not expired, the browser carries out DNS analysis on the domain name list a.example.com in the x-pre-connect and establishes TCP connection. If the network protocol is HTTPS, a ssl handshake is also required.
And 6K, the browser receives the main resource and loads the main resource.
And 6L, loading sub-resources of the web page http:// example.com by the browser according to the TCP connection, forming the web page and displaying the web page.
Therefore, when the user accesses the a.example.com webpage again, the browser can actively acquire the domain name list a.example.com in the x-pre-connect in the idle time for capturing the main resource and waiting for the response of the main resource, and perform DNS analysis and TCP pre-connection on the sub-resource, but does not need to wait until the main resource responds to perform DNS analysis and TCP pre-connection, so that the time consumption for domain name analysis and TCP connection establishment of the sub-resource is saved, and the page opening speed is increased.
An embodiment of the present invention provides a preloading device 70, as shown in fig. 7, where the device 70 includes:
a sending unit 701, configured to send an access request to a web server, where the access request includes a domain name of a web page to be displayed.
An establishing unit 702, configured to locally obtain protocol response data corresponding to the domain name in a process of waiting for the web page server to return web page data of the web page to be displayed according to the domain name, where the protocol response data includes a domain name list of at least one sub-resource of the web page to be displayed; and establishing a Transmission Control Protocol (TCP) connection of each sub-resource according to the domain name list of the at least one sub-resource.
The receiving unit 703 is configured to receive the web page data of the web page to be displayed, where the web page data includes the main resource of the web page to be displayed, and the web page data is sent by the web page server.
The loading unit 703 is configured to load the main resource of the web page to be displayed and load the sub-resource of the web page to be displayed according to the TCP connection, so as to form the web page to be displayed.
Therefore, when a user accesses the webpage through the browser, the browser can capture the main resource of the webpage and wait for the idle time of main resource response, the sub-resource of the webpage can be actively captured according to the pre-stored protocol response data and TCP connection is established, the sub-resource does not need to be captured after the browser responds to the main resource, and the sub-resource captured by the browser is saved; and the time consumption for establishing the TCP connection is reduced, and the opening speed of the webpage is improved.
In other embodiments of the present invention, the protocol response data further comprises a time threshold; as shown in fig. 8, the apparatus 70 further includes:
a determining unit 704, configured to determine whether a storage duration of the protocol response data is less than or equal to a time threshold;
the establishing unit 702 is specifically configured to establish a TCP connection of each sub-resource according to the domain name list of the at least one sub-resource if the storage duration of the protocol response data is less than or equal to the time threshold.
In other embodiments of the present invention, the web page data further includes protocol response data of the web page to be displayed; as shown in fig. 9, the apparatus 70 further includes:
an updating unit 705, configured to update the locally stored protocol response data according to the protocol response data of the to-be-displayed webpage in the received webpage data if the storage duration of the protocol response data is greater than the time threshold.
In other embodiments of the present invention, the domain name list of each of the sub-resources includes a domain name, a protocol identifier, and a port identifier; the establishing unit 702 is specifically configured to: performing domain name system DNS analysis on the domain name list of the sub-resources to obtain a network protocol IP address corresponding to the domain name of the sub-resources; and establishing TCP connection between the IP address of the server storing the sub-resources and the browser according to the protocol identifier and the port identifier corresponding to the sub-resources.
An embodiment of the present invention provides a preloading device 100, as shown in fig. 10, where the device 100 includes a communication interface 1001 and a processor 1002:
the processor 1002 is configured to send an access request to a web server through the communication interface 1001, where the access request includes a domain name of a web page to be displayed; in the process of waiting for the webpage server to return the webpage data of the webpage to be displayed according to the domain name, protocol response data corresponding to the domain name are obtained from local, wherein the protocol response data comprise a domain name list of at least one sub-resource of the webpage to be displayed; establishing a Transmission Control Protocol (TCP) connection of each sub-resource according to the domain name list of the at least one sub-resource; receiving, through the communication interface 1001, web page data of the web page to be displayed, which is sent by the web server, where the web page data includes a main resource of the web page to be displayed; and loading the main resource of the webpage to be displayed and loading the sub-resource of the webpage to be displayed according to the TCP connection to form the webpage to be displayed.
Therefore, when a user accesses the webpage through the browser, the browser can capture the main resource of the webpage and wait for the idle time of main resource response, the sub-resource of the webpage can be actively captured according to the pre-stored protocol response data and TCP connection is established, the sub-resource does not need to be captured after the browser responds to the main resource, and the sub-resource captured by the browser is saved; and the time consumption for establishing the TCP connection is reduced, and the opening speed of the webpage is improved.
In other embodiments of the present invention, the protocol response data further comprises a time threshold; the processor 1002 is configured to: determining whether a storage duration of the protocol response data is less than or equal to a time threshold; and if the storage duration of the protocol response data is less than or equal to the time threshold, establishing the TCP connection of each sub-resource according to the domain name list of the at least one sub-resource.
In other embodiments of the present invention, the web page data further includes protocol response data of the web page to be displayed; the processor 1002 is configured to: and if the storage duration of the protocol response data is greater than the time threshold, updating the locally stored protocol response data according to the received protocol response data of the webpage to be displayed in the webpage data.
In other embodiments of the present invention, the domain name list of each of the sub-resources includes a domain name, a protocol identifier, and a port identifier; the processor 1002 is configured to: performing domain name system DNS analysis on the domain name list of the sub-resources to obtain a network protocol IP address corresponding to the domain name of the sub-resources; and establishing TCP connection between the IP address of the server storing the sub-resources and the browser according to the protocol identifier and the port identifier corresponding to the sub-resources.
Here, it should be noted that: the description of the above device embodiment is similar to the description of the above method, and has the same beneficial effects as the method embodiment, and therefore, the description thereof is omitted. For technical details that are not disclosed in the embodiment of the apparatus of the present invention, those skilled in the art should refer to the description of the embodiment of the method of the present invention to understand that, for the sake of brevity, detailed description is omitted here.
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present invention. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. It should be understood that, in various embodiments of the present invention, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention. The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units; can be located in one place or distributed on a plurality of network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment. In addition, all the functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately regarded as one unit, or two or more units may be integrated into one unit; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: various media that can store program codes, such as a removable Memory device, a Read Only Memory (ROM), a magnetic disk, or an optical disk. Alternatively, the integrated unit of the present invention may be stored in a computer-readable storage medium if it is implemented in the form of a software functional module and sold or used as a separate product. Based on such understanding, the technical solutions of the embodiments of the present invention may be essentially implemented or a part contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a removable storage device, a ROM, a magnetic or optical disk, or other various media that can store program code.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.
Claims (7)
1. A preloading method, comprising:
sending an access request to a webpage server, wherein the access request comprises a domain name of a webpage to be displayed;
receiving webpage data of a webpage to be displayed, which is sent by the webpage server, wherein the webpage data comprises main resources of the webpage to be displayed;
acquiring a response head corresponding to the domain name from the local of a terminal, wherein the response head comprises a time threshold and a domain name list of at least one sub-resource of the webpage to be displayed, and the response head is received from the webpage server and stored in the local of the terminal after the terminal sends an access request to the webpage server last time;
when the storage duration of the response head is less than or equal to a time threshold, determining that the locally stored response head of the terminal is still valid, and establishing a Transmission Control Protocol (TCP) connection of each sub-resource in the process of waiting for receiving the webpage data according to a domain name list of at least one sub-resource included in the response head;
loading the main resource of the webpage to be displayed to form a frame of the webpage to be displayed;
loading the sub-resources of the webpage to be displayed according to the TCP connection while loading the main resources of the webpage to be displayed;
filling the loaded sub-resources of the webpage to be displayed in a frame of the webpage to be displayed to form the webpage to be displayed;
when the storage duration of the response head is greater than the time threshold and the response head included in the webpage data is the same as the response head stored locally, updating a timer for recording the storage duration and establishing the TCP connection of each sub-resource;
when the storage duration of the response head is greater than the time threshold and the response head included in the webpage data is different from the locally stored response head, updating the locally stored response head according to the response head of the webpage to be displayed in the received webpage data, and establishing the TCP connection of each sub-resource according to the updated response head;
loading the main resource of the webpage to be displayed to form a frame of the webpage to be displayed, and loading the sub-resource of the webpage to be displayed according to the TCP connection;
and filling the loaded sub-resources of the webpage to be displayed in the frame of the webpage to be displayed to form the webpage to be displayed.
2. The method of claim 1, further comprising:
sending an access request to the webpage server, wherein the access request comprises a domain name of a webpage to be displayed;
receiving webpage data of the webpage to be displayed, which is sent by the webpage server, wherein the webpage data comprises the main resource of the webpage to be displayed and the response head;
and acquiring the response head included in the webpage data, and storing the response head locally.
3. The method of claim 1, further comprising:
performing Secure Socket Layer (SSL) handshake on the TCP connection of each sub-resource;
and if the SSL handshake of the TCP connection of each sub-resource is successful, loading the main resource of the webpage to be displayed, and loading the sub-resource of the webpage to be displayed according to the TCP connection to form the webpage to be displayed.
4. The method of claim 1, wherein the list of domain names for each of the sub-resources comprises a domain name, a protocol identifier, and a port identifier;
the establishing of the TCP connection of each sub-resource according to the list of domain names of the at least one sub-resource comprises:
performing domain name system DNS analysis on the domain name list of the sub-resources to obtain a network protocol IP address corresponding to the domain name of the sub-resources;
and establishing TCP connection between the IP address of the server storing the sub-resources and the browser according to the protocol identifier and the port identifier corresponding to the sub-resources.
5. A preload apparatus, comprising:
the device comprises a sending unit, a display unit and a display unit, wherein the sending unit is used for sending an access request to a webpage server, and the access request comprises a domain name of a webpage to be displayed;
the system comprises an establishing unit, a display unit and a display unit, wherein the establishing unit is used for receiving webpage data of a webpage to be displayed, which are sent by a webpage server, and the webpage data comprise main resources of the webpage to be displayed; acquiring a response head corresponding to the domain name from the local of a terminal, wherein the response head comprises a time threshold and a domain name list of at least one sub-resource of the webpage to be displayed, and the response head is received from the webpage server and stored in the local of the terminal after the terminal sends an access request to the webpage server last time; when the storage duration of the response head is less than or equal to a time threshold, determining that the locally stored response head of the terminal is still valid, and establishing a Transmission Control Protocol (TCP) connection of each sub-resource in the process of waiting for receiving the webpage data according to a domain name list of at least one sub-resource included in the response head; when the storage duration of the response head is greater than the time threshold and the response head included in the webpage data is the same as the response head stored locally, updating a timer for recording the storage duration and establishing the TCP connection of each sub-resource; when the storage duration of the response head is greater than the time threshold and the response head included in the webpage data is different from the locally stored response head, updating the locally stored response head according to the response head of the webpage to be displayed in the received webpage data, and establishing the TCP connection of each sub-resource according to the updated response head;
the receiving unit is used for receiving webpage data of the webpage to be displayed, which are sent by the webpage server, wherein the webpage data comprise main resources of the webpage to be displayed;
the loading unit is used for loading the main resource of the webpage to be displayed when the storage duration of the response head is less than or equal to a time threshold value to form a frame of the webpage to be displayed; loading the sub-resources of the webpage to be displayed according to the TCP connection while loading the main resources of the webpage to be displayed; filling the loaded sub-resources of the webpage to be displayed in a frame of the webpage to be displayed to form the webpage to be displayed; when the storage duration of the response head is greater than the time threshold, loading the main resource of the webpage to be displayed to form a frame of the webpage to be displayed, and loading the sub-resource of the webpage to be displayed according to the TCP connection; and filling the loaded sub-resources of the webpage to be displayed in the frame of the webpage to be displayed to form the webpage to be displayed.
6. A pre-load device, characterized in that the device comprises a communication interface and a processor:
the processor is used for sending an access request to a webpage server through the communication interface, wherein the access request comprises a domain name of a webpage to be displayed; receiving webpage data of the webpage to be displayed, which is sent by the webpage server, wherein the webpage data comprises main resources of the webpage to be displayed; acquiring a response head corresponding to the domain name from the local of a terminal, wherein the response head comprises a time threshold and a domain name list of at least one sub-resource of the webpage to be displayed, and the response head is received from the webpage server and stored in the local of the terminal after the terminal sends an access request to the webpage server last time; when the storage duration of the response head is less than or equal to a time threshold, determining that the locally stored response head of the terminal is still valid, and establishing a Transmission Control Protocol (TCP) connection of each sub-resource in the process of waiting for receiving the webpage data according to a domain name list of at least one sub-resource included in the response head; loading the main resource of the webpage to be displayed to form a frame of the webpage to be displayed; loading the sub-resources of the webpage to be displayed according to the TCP connection while loading the main resources of the webpage to be displayed; filling the loaded sub-resources of the webpage to be displayed in a frame of the webpage to be displayed to form the webpage to be displayed; when the storage duration of the response head is greater than the time threshold and the response head included in the webpage data is the same as the response head stored locally, updating a timer for recording the storage duration and establishing the TCP connection of each sub-resource; when the storage duration of the response head is greater than the time threshold and the response head included in the webpage data is different from the locally stored response head, updating the locally stored response head according to the response head of the webpage to be displayed in the received webpage data, and establishing the TCP connection of each sub-resource according to the updated response head; loading the main resource of the webpage to be displayed to form a frame of the webpage to be displayed, and loading the sub-resource of the webpage to be displayed according to the TCP connection; and filling the loaded sub-resources of the webpage to be displayed in the frame of the webpage to be displayed to form the webpage to be displayed.
7. A storage medium storing executable instructions for implementing the preloading method according to any one of claims 1 to 4 when executed by a computer device.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610590423.2A CN107656934B (en) | 2016-07-25 | 2016-07-25 | Preloading method, device and equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610590423.2A CN107656934B (en) | 2016-07-25 | 2016-07-25 | Preloading method, device and equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107656934A CN107656934A (en) | 2018-02-02 |
CN107656934B true CN107656934B (en) | 2021-09-07 |
Family
ID=61126716
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610590423.2A Active CN107656934B (en) | 2016-07-25 | 2016-07-25 | Preloading method, device and equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107656934B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110020305B (en) * | 2017-11-29 | 2023-12-12 | 深圳市雅阅科技有限公司 | Webpage loading method, webpage loading device, computer equipment and storage medium |
CN111061974A (en) * | 2019-11-26 | 2020-04-24 | 贝壳技术有限公司 | Client page loading method and device and page loading method and system |
CN111191158A (en) * | 2019-12-27 | 2020-05-22 | 北京达佳互联信息技术有限公司 | Web page resource caching method, apparatus, computer equipment and storage medium |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6128712A (en) * | 1997-01-31 | 2000-10-03 | Macromedia, Inc. | Method and apparatus for improving playback of interactive multimedia works |
US6826592B1 (en) * | 1998-09-11 | 2004-11-30 | L.V. Partners, L.P. | Digital ID for selecting web browser and use preferences of a user during use of a web application |
EP2518968B1 (en) * | 2009-12-22 | 2020-01-22 | Alcatel Lucent | Method and devices for providing network service to a mobile user equipment |
CN102710748B (en) * | 2012-05-02 | 2016-01-27 | 华为技术有限公司 | Data capture method, system and equipment |
CN103365695B (en) * | 2013-07-31 | 2017-04-26 | 广州市动景计算机科技有限公司 | Method and device for increasing sub-resource loading speed |
CN103955495B (en) * | 2014-04-18 | 2018-05-04 | 百度在线网络技术(北京)有限公司 | The method for down loading and device of page child resource |
CN104156421B (en) * | 2014-08-06 | 2018-11-09 | 百度在线网络技术(北京)有限公司 | The page shows method, apparatus and system |
CN104965659B (en) * | 2015-07-06 | 2017-12-15 | 无锡天脉聚源传媒科技有限公司 | A kind of preloading method and device of page info |
-
2016
- 2016-07-25 CN CN201610590423.2A patent/CN107656934B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN107656934A (en) | 2018-02-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR101362384B1 (en) | The method and system for browsing things of internet of things on ip using web platform | |
US9071651B2 (en) | Dynamic content delivery to network-enabled static display device | |
US8156418B2 (en) | Image acquisition from dynamic content for delivery to network-enabled static display devices | |
US8417772B2 (en) | Method and system for transferring content from the web to mobile devices | |
CN101894136B (en) | Based on page refreshing processing method and the system thereof of mobile terminal | |
CA2839006C (en) | Methods for making ajax web applications bookmarkable and crawlable and devices thereof | |
US20090037517A1 (en) | Method and system to share content between web clients | |
CN106331149A (en) | Webpage code adapting method applicable to client environment | |
WO2014026606A1 (en) | Method, system and device for filtering mobile terminal webpage advertisements | |
CN104063460A (en) | Method and device for loading webpage in browser | |
CN102929985A (en) | Method and system for displaying collected webpage | |
US20120331376A1 (en) | Inserting content in association with a web page that is transmitted to a computing device | |
CN103246699A (en) | Method and device for data access control based on browser | |
CN103888540B (en) | Login information synchronization method, synchronized network servers and synchronizing network servers | |
CN105354337A (en) | Web crawler implementation method and web crawler system | |
CN105516333B (en) | A kind of web-based exchange method and system | |
CN107656934B (en) | Preloading method, device and equipment | |
CN102346738A (en) | Customized web page processing device and method | |
JP5112401B2 (en) | Web action history acquisition system, Web action history acquisition method, gateway device, and program | |
CN103401926A (en) | Method and device for improving network resource access speed | |
CN104361130B (en) | Method for searching local area network or specified network segment equipment in webpage | |
WO2009109628A1 (en) | Method of tracking usage of client computer and system for same | |
CN105279156A (en) | Network information communication method and network information browsing device | |
JP2013164666A (en) | Portlet processing device, portal server, portal system, portlet processing method and computer program | |
KR20120025209A (en) | System for displaying cached web page, server thereof, terminal thereof, method thereof and computer recordable medium storing the method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20221117 Address after: 1402, Floor 14, Block A, Haina Baichuan Headquarters Building, No. 6, Baoxing Road, Haibin Community, Xin'an Street, Bao'an District, Shenzhen, Guangdong 518133 Patentee after: Shenzhen Yayue Technology Co.,Ltd. Address before: 2, 518000, East 403 room, SEG science and Technology Park, Zhenxing Road, Shenzhen, Guangdong, Futian District Patentee before: TENCENT TECHNOLOGY (SHENZHEN) Co.,Ltd. |