CN108153778B - Webpage storage method, webpage reading method and device - Google Patents

Webpage storage method, webpage reading method and device Download PDF

Info

Publication number
CN108153778B
CN108153778B CN201611105483.7A CN201611105483A CN108153778B CN 108153778 B CN108153778 B CN 108153778B CN 201611105483 A CN201611105483 A CN 201611105483A CN 108153778 B CN108153778 B CN 108153778B
Authority
CN
China
Prior art keywords
webpage
page data
web page
resource
communication network
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
Application number
CN201611105483.7A
Other languages
Chinese (zh)
Other versions
CN108153778A (en
Inventor
刘强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201611105483.7A priority Critical patent/CN108153778B/en
Publication of CN108153778A publication Critical patent/CN108153778A/en
Application granted granted Critical
Publication of CN108153778B publication Critical patent/CN108153778B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/986Document structures and storage, e.g. HTML extensions

Abstract

The invention discloses a webpage storage method, a webpage reading method and a webpage reading device, and belongs to the technical field of the Internet. The method comprises the following steps: receiving an offline storage instruction of a target webpage; acquiring an interactive relation of at least two page data contents in a target webpage through a webpage storage plug-in, wherein the interactive relation is used for indicating a switching logic of the page data contents when user operation is received; and saving at least two page data contents and the interaction relation in the target webpage as a preset webpage file through the webpage saving plug-in. The invention solves the problem that only one page data content of the H5 webpage can be displayed and other page data contents of the H5 webpage cannot be switched according to the interaction operation of a user and the page data contents when the stored H5 webpage is read off line, so that the user can switch to other page data contents through the interaction operation with the page data contents when the user reads the off-line stored webpage.

Description

Webpage storage method, webpage reading method and device
Technical Field
The embodiment of the invention relates to the technical field of internet, in particular to a webpage storage method, a webpage reading method and a webpage reading device.
Background
The off-line storage of the web page is a mode of storing the web page file of the web page to the local so that the web page can still be read in an off-line state. The web page file is a file containing resources such as HTML (HyperText Markup Language) tags, characters, pictures, audio, and video.
Currently, the off-line saving of a web page is to download and save resources such as pictures, characters, CSS (Cascading Style Sheets) files, HTML files, and the like in one web page as a web page file with mht as an extension through a browser. Taking an H5(HTML 5) web page as an example, when an H5 web page needs to be saved, the browser saves all resources such as characters, pictures, CSS files, HTML files, and the like in the H5 web page into a web page file with mht as an extension.
Since the H5 webpage has strong interactive characteristics, a plurality of page data contents can be included in one H5 webpage, and there is an interactive relationship between the respective page data contents. Taking a music album implemented using the H5 web page as an example, one music album contains 5 page data contents, and the user can switch between different page data contents of the H5 web page by sliding left and right. However, after the H5 web page of the music album is saved by the above method, when the H5 web page is read off-line, only one page data content displayed when the H5 web page is saved can be displayed, and the H5 web page cannot be switched to another page data content according to the user's interaction with the page data content.
Disclosure of Invention
In order to solve the problem that in the prior art, after an H5 webpage with strong interaction characteristics is saved, when the saved H5 webpage is read off-line, only one page data content displayed when the H5 webpage is saved can be displayed, and the other page data content of the H5 webpage cannot be switched according to the interaction operation between a user and the page data content, embodiments of the present invention provide a webpage saving method, a webpage reading method, and a webpage reading apparatus. The technical scheme is as follows:
in a first aspect, a method for saving a web page is provided, where the method includes:
receiving an offline storage instruction of a target webpage;
acquiring an interactive relation of at least two page data contents in the target webpage through a webpage storage plug-in, wherein the interactive relation is used for indicating switching logic of the page data contents when user operation is received;
and saving at least two page data contents in the target webpage and the interaction relation as a preset webpage file through the webpage saving plug-in.
In a second aspect, a method for reading a web page is provided, the method including:
acquiring a preset webpage file of a target webpage;
acquiring at least two page data contents in the target webpage and an interactive relation of the at least two page data contents from the preset webpage file through a webpage storage plug-in, wherein the interactive relation is used for indicating a switching logic of the page data contents when user operation is received;
displaying the page data content in the target webpage;
and when user operation is received, switching the page data content according to the interactive relation of the at least two page data contents.
In a third aspect, an apparatus for saving a web page is provided, the apparatus including:
the receiving module is used for receiving an offline storage instruction of the target webpage;
the acquisition module is used for acquiring the interaction relation of at least two page data contents in the target webpage through a webpage storage plug-in, wherein the interaction relation is used for indicating the switching logic of the page data contents when user operation is received;
and the storage module is used for storing the at least two page data contents in the target webpage and the interaction relation acquired by the acquisition module into a preset webpage file through the webpage storage plug-in.
In a fourth aspect, there is provided a web page reading apparatus, the apparatus including:
the first acquisition module is used for acquiring a preset webpage file of a target webpage;
a second obtaining module, configured to obtain, from the predetermined webpage file read by the first obtaining module through a webpage saving plug-in, an interaction relationship between at least two page data contents in the target webpage and the at least two page data contents, where the interaction relationship is used to indicate a switching logic of the page data contents when a user operation is received;
the first display module is used for displaying the page data content in the target webpage;
and the switching module is used for switching the page data contents displayed by the first display module according to the interactive relationship of the at least two page data contents when user operation is received.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
the interactive relation between the multiple page data contents of the webpage and the multiple page data contents is stored as a preset webpage file through the webpage storage plug-in, and the interactive relation between the multiple page data contents can be recovered through the webpage storage plug-in when the stored webpage is read due to the fact that the interactive relation between the multiple page data contents is stored; therefore, when a user reads the webpage stored offline, the user can still switch between different page data contents of the webpage through interactive operation with the page data contents.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flow diagram of a method for web page saving provided in one embodiment of the present invention;
FIG. 2 is a flowchart of a method for reading a web page provided in an embodiment of the invention;
FIG. 3A is a flowchart of a method for saving a web page provided in another embodiment of the present invention;
FIG. 3B is a schematic diagram of an exemplary web page save method provided in one embodiment of the invention;
FIG. 4A is a flowchart of a method for reading a web page according to another embodiment of the present invention;
FIG. 4B is a diagram illustrating a prompt window for an update request provided in one embodiment of the invention;
FIG. 4C is a schematic diagram of an exemplary web page read method provided in one embodiment of the present invention;
FIG. 5A is a schematic illustration of an implementation environment in accordance with some embodiments of the invention;
FIG. 5B is a diagram illustrating a web page save process according to some embodiments of the invention;
FIG. 5C is a schematic diagram of a web page read process according to some embodiments of the invention;
fig. 6 is a block diagram showing the structure of a web page saving apparatus according to an embodiment of the present invention;
fig. 7 is a block diagram showing a configuration of a web page reading apparatus according to an embodiment of the present invention;
fig. 8 is a block diagram showing a hardware device according to a part of the embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
When a user wishes to read a web page still in an offline state, the web page may be saved offline, in the prior art, the saving of a single page data content (a page data content displayed during saving) in the web page may be implemented, and when one web page includes a plurality of page data contents, the web page saving method as shown in fig. 1 may be implemented.
Fig. 1 is a flowchart of a method for saving a web page according to an embodiment of the present invention. In this embodiment, the web page saving method is exemplified by being applied to a terminal with a web page browsing function, and a browser or a third party application with a web page browsing function is installed in the terminal. As shown in fig. 1, the method for saving a web page includes:
step 101, receiving an offline saving instruction for a target webpage.
In practical applications, when a user wants to be able to read a web page in an offline state, the web page is saved offline by triggering a related control, such as an option control for saving the web page in a browser. When the control for saving the webpage is triggered, the terminal receives an offline saving instruction for the webpage.
The target web page is a web page that the user wishes to save offline.
And 102, acquiring the interactive relation of at least two page data contents in the target webpage through the webpage storage plug-in.
The page data content refers to content displayed to a user through a web page, And the page data content includes various resources of the page, such as pictures, documents, videos, music, CSS files, HTML files, js (Javascript) files, ajax (asynchronous Javascript And xml) files, And the like.
The interaction relation is used for indicating switching logic of the page data content when receiving user operation. The switching logic includes switching logic for single page data content and/or switching logic between multiple page data content. For example, the user slides to the left, and the displayed page data content is switched from the current page data content to the next page data content; for another example, the page data content includes a control for controlling music playing, and the user can control the music playing or stopping in the web page by triggering the control.
In one possible implementation, the web page includes at least two page data contents. Taking the H5 webpage as an example, one H5 webpage may include a plurality of page data contents, and there is an interaction relationship between the respective page data contents, so that a user may switch between different page data contents of the H5 webpage through an interaction operation like sliding left and right.
The webpage saving plug-in is a program for saving the webpage offline and reading the webpage saved offline. Optionally, the web page save plug-in is a service worker.
In one possible implementation manner, the third-party application program can implement the function of saving the webpage offline without installing a browser by installing the webpage saving plug-in.
And 103, saving at least two page data contents and the interaction relation in the target webpage as a preset webpage file through the webpage saving plug-in.
When saving each page data content of the web page, the web page saving plug-in saves all resources included in each page data content, such as characters, pictures, videos, music, CSS files, HTML files, and the like.
The webpage saving plug-in can save the interaction relation of the page data contents besides saving the data contents of all the pages of the webpage, so that when a user reads an offline webpage, the webpage saving plug-in can restore the webpage to a state capable of responding to the user operation according to the interaction relation of the page data contents.
After the webpage storage plug-in obtains the interactive relationship of at least two page data contents, the webpage storage plug-in stores each page data content of the webpage and the interactive relationship of each page data content as a preset webpage file.
Optionally, the predetermined web page file is a mht file with mht as an extension.
Optionally, when the webpage saving plug-in saves the predetermined webpage file, a predetermined identifier is added to the predetermined webpage file to indicate that the saved mht file is saved through the webpage saving plug-in, and the mht file stores the interaction relationship between the page data content and the page data content. Optionally, the predetermined identifier is a naming mode of the mht file or an icon of the mht file. The embodiment does not limit the specific implementation manner of the predetermined identifier.
In summary, in the webpage saving method provided in the embodiment of the present invention, the webpage saving plug-in saves the interaction relationship between the multiple page data contents of the webpage and the multiple page data contents as the predetermined webpage file, and the interaction relationship between the multiple page data contents can be restored by the webpage saving plug-in when the saved webpage is read because the interaction relationship between the multiple page data contents is saved; therefore, when a user reads the webpage stored offline, the user can still switch between different page data contents of the webpage through interactive operation with the page data contents.
After saving the web page by the web page saving method shown in fig. 1, the user may read the off-line saved web page in an off-line state, and the reading of the saved predetermined web page file may be implemented by the web page reading method shown in fig. 2.
Fig. 2 is a flowchart of a method for reading a web page according to an embodiment of the present invention. In this embodiment, the web page reading method is exemplified by being applied to a terminal having a web page browsing function, and a browser or a third party application having a web page browsing function is installed in the terminal. As shown in fig. 2, the web page reading method includes:
step 201, acquiring a predetermined webpage file of a target webpage.
Alternatively, the predetermined web page file is an mht file saved by the web page saving method shown in fig. 1.
In practical application, when reading the saved mht file, it is necessary to determine whether the saved mht file is a predetermined web page file, that is, to identify whether the saved mht file has a predetermined identifier of the predetermined web page file. For example, whether the naming mode of the saved mht file is the naming mode of the predetermined webpage file or not is identified, or whether the icon of the saved mht file is the icon of the predetermined webpage file or not is identified.
If the saved mht file is not the predetermined web page file saved by the web page saving method shown in fig. 1, the mht file is directly opened in a manner of reading a normal mht file provided in the prior art.
If the saved mht file is a predetermined web page file saved by the web page saving method shown in fig. 1, step 202 is executed.
Step 202, acquiring at least two page data contents in the target webpage and the interaction relationship of the at least two page data contents from a preset webpage file through a webpage saving plug-in.
The interaction relation is used for indicating switching logic of the page data content when receiving user operation. The switching logic includes switching logic for single page data content and/or switching logic between multiple page data content.
When the preset webpage file is stored, the webpage storage plug-in stores the interactive relationship between the page data content of the target webpage and at least two page data contents into the preset webpage file, so that when the stored preset webpage file is read, the target webpage is reconstructed or rendered by reading the interactive relationship between each page data content and each page data content. For example, the web page saving plug-in reads resources such as characters, pictures, music, videos, CSS files, HTML files and the like corresponding to the page data contents, combines the read resources into the corresponding page data contents when the web page is saved offline, and renders the combined page data contents into a web page capable of interacting with the user operation according to the interaction relationship corresponding to the page data contents.
And step 203, displaying the page data content in the target webpage.
And when the webpage storage plug-in obtains the target webpage through rendering according to the interaction relation between the webpage data content and the webpage data content in the preset webpage file, the webpage data content in the target webpage can be displayed on the terminal.
Optionally, the displayed page data content is one of a plurality of page data contents contained in the target webpage.
And 204, when user operation is received, switching the page data content according to the interactive relation of at least two page data contents.
After the page data content of the target webpage is rendered and reconstructed, the user can operate the page data content. And when the webpage receives the user operation, switching the data content of the webpage according to the interactive relation corresponding to the user operation. For example, when the user performs an operation of sliding to the left, the displayed page data content is switched from the current page data content to the next page data content; for another example, the page data content includes a control for controlling music playing, the current music is playing, and the user can control the stop of the music playing in the target web page by triggering the control.
In summary, in the webpage reading method provided in the embodiment of the present invention, when the predetermined webpage file is read, the interaction relationship between the page data content and the page data content in the predetermined webpage file is obtained, and the target webpage is reconstructed and rendered into the webpage capable of responding to the user operation. Even if the H5 webpage with strong interactive characteristics is stored, the interactive function of the H5 webpage can be recovered when the H5 webpage stored offline is read, so that the H5 webpage stored offline can respond to the user operation, and the user can still switch to other page data contents through the interactive operation with the page data contents when reading the webpage stored offline.
Since the web page saving method shown in fig. 1 requires offline saving of the web page using the web page saving plug-in, it is necessary to detect whether the web page saving plug-in is installed when the web page is saved offline. In addition, in order to enable a user to view all resources on a target web page in an offline state, all resources of the target web page need to be downloaded when the web page is saved offline. Please refer to the method for saving web page shown in fig. 3A.
Fig. 3A is a flowchart of a method for saving a web page according to another embodiment of the present invention. In this embodiment, the web page saving method is exemplified by being applied to a terminal with a web page browsing function, and a browser or a third party application with a web page browsing function is installed in the terminal. As shown in fig. 3A, the method for saving a web page includes:
step 301, receiving an offline saving instruction for a target webpage.
Typically, an offline save instruction for the target web page is received by a browser in the terminal.
In a possible implementation, a browser in the terminal is provided with a first menu item for offline saving a web page, and when a user clicks the first menu item in a process of browsing a target web page, an offline saving instruction for the target web page is triggered, and the browser receives the offline saving instruction.
In another possible implementation, a third-party application in the terminal has a web page browsing capability, and the third-party application provides a second menu item for saving a web page offline, and when a user uses the third-party application to browse a target web page, clicking the second menu item triggers an offline saving instruction for the target web page, and the third-party application calls a browser to complete the offline saving instruction.
Step 302, detecting whether a web page save plug-in has been installed.
In one possible implementation, the web page save plug-in is a service worker. The service worker provides the ability to perform functions in the background that do not require interaction with the web page, such as the ability to perform offline save functions in the background, independent of the current web page. An independent process for storing the web page off line can be created through the service worker. The independent process has the ability to identify and collect code about user interactions.
If the webpage saving plug-in is not installed, go to step 303; if a web page save plug-in has been installed, step 305 is entered.
Step 303, if the webpage saving plug-in is not installed, detecting whether the currently connected communication network is the first communication network.
Optionally, the first communication network is a communication network with unlimited download traffic or download cost lower than a threshold or free use, such as a WiFi (WIreless-Fidelity) network.
If the currently connected communication network is the first communication network, go to step 304; if the currently connected communication network is different from the first communication network, the user is asked whether to approve the download, and when the user approves the download, the step 305 is entered.
Step 304, downloading and installing the webpage saving plug-in.
And downloading and installing the service worker by the browser. When the communication network currently connected with the terminal is the first communication network, the process of downloading and installing the webpage storage plug-in is automatically executed without interaction with a user; when the communication network to which the terminal is currently connected is the second communication network, the user needs to be asked whether to approve the current download, and when the user approves the current download, the process proceeds to step 305.
The priority of the second communication network is lower than the priority of the first communication network.
And 305, acquiring a webpage source code of the target webpage through the webpage saving plug-in.
Optionally, the terminal obtains the web page source code of the target web page from the server through the web page saving plug-in.
And step 306, traversing the interactive code segments related to the interactive relationship in the webpage source codes through the webpage saving plug-in, and obtaining the interactive relationship of at least two page data contents according to the interactive code segments.
The interaction relation is used for indicating switching logic of the page data content when receiving user operation. The switching logic includes switching logic for single page data content and/or switching logic between multiple page data content.
When an interactive relationship exists between two page data contents, such as the hierarchy and the front-back relationship between the first page data content and the second page data content, and a logic operation for switching from the first page data content to the second page data content, and the like, an interactive code segment for describing the interactive relationship exists in the webpage source code.
The webpage saving plug-in traverses all interactive code segments related to the interactive relation in the webpage source code, and saves the interactive relation of at least two page data contents by copying the interactive code segments.
Optionally, in order to enable the user to view all web page resources of the data content of each page in the target web page in the offline state, the browser further needs to download all the resources in the target web page through step 307 and step 308.
Step 307, acquiring a resource address from the webpage source code through the webpage saving plug-in.
Optionally, the web page source code of the target web page includes various resources, such as pictures, audio, video, and the like. Each resource corresponds to a respective resource address. Alternatively, the Resource address is represented by a URI (Uniform Resource Identifier) address.
And 308, downloading all webpage resources of the target webpage from the resource address through the webpage saving plug-in.
The target webpage comprises all webpage resources which are used for forming at least two webpage data contents.
And in the process of opening the target webpage, the browser requests a server corresponding to the target webpage to load resources according to the resource address. The webpage storage plug-in stores all webpage resources by downloading or copying all webpage resources of the target webpage.
It should be noted that step 306 and step 308 may be executed in parallel, or step 308 is executed before step 306, which is not limited in the embodiment of the present invention.
Step 309, saving the web page resources, the resource addresses corresponding to the web page resources and the interaction relationship as a predetermined web page file through the web page saving plug-in.
The predetermined webpage file is a mht file with mht as an extension.
Optionally, when the webpage saving plug-in saves the predetermined webpage file, a predetermined identifier is added to the predetermined webpage file to indicate that the mht file saved offline this time is saved by the webpage saving plug-in, and the mht file stores webpage resources required by each page data content, resource addresses corresponding to each webpage resource, an interactive relationship of a single page data content, and an interactive relationship of one page data content and another page data content. Optionally, the predetermined identifier is represented by a naming mode of a mht file or an icon of a mht file, for example, if the predetermined identifier is represented by a naming mode of "H5 service + serial number", the web page file with the name of H5service1.mht is a predetermined web page file. The embodiment does not limit the specific implementation manner of the predetermined identifier.
The webpage storage plug-in stores all webpage resources of the target webpage into a preset webpage file, so that all webpage resources related to the target webpage can still be browsed when the target webpage is read in an off-line state. For example, when the video resource in the target webpage is downloaded, the video in the target webpage can still be played normally when the target webpage is read in an offline state.
The webpage saving plug-in also saves the resource address corresponding to each webpage resource into a preset webpage file, so that the webpage saving plug-in can detect whether the webpage resource is updated according to the saved resource address when a communication network exists, and can provide the updated webpage resource for a user when the webpage resource is updated.
The webpage saving plug-in also saves the interaction relation to a preset webpage file, so that the interaction relation among a plurality of page data contents in the target webpage can be restored when the target webpage is read off line.
In a possible implementation, when a webpage saving plug-in is not installed on a terminal and a communication network to which the terminal is currently connected is not a first communication network, a target webpage is saved as a common webpage file with mht as an extension, the common mht file can only save single page data content in the target webpage and does not store all resources (such as only storing video resource addresses but not storing video files) related to the target webpage and interaction relations of the data contents of the pages, so that the resource addresses stored in the common mht file have a possibility of failure. When the resource address is invalid, the corresponding webpage resource cannot be found when the target webpage is read.
For the web page saving method in the present embodiment, it can be explained with reference to a schematic diagram of an exemplary web page saving method shown in fig. 3B. In fig. 3B, S31 is the offline saving of the web page, and S32 needs to be executed first when the web page is saved offline; s32, judging whether a webpage saving plug-in is installed or not, if the judgment result of S32 is yes, executing S33, and saving the target webpage as a preset webpage file; if the judgment result of the S32 is negative, executing S34, and judging whether the terminal is connected with the WiFi network; if the judgment result of S34 is yes, executing S35 and installing a webpage save plug-in; after the installation of the web page saving plug-in is completed at S35, executing S33, saving the target web page as a predetermined web page file; and if the judgment result of the S34 is negative, executing S36 and saving the target webpage as a common mht file.
In summary, in the webpage saving method provided in the embodiment of the present invention, the webpage saving plug-in saves the interaction relationship between the multiple page data contents of the webpage and the multiple page data contents as the predetermined webpage file, and the interaction relationship between the multiple page data contents can be restored by the webpage saving plug-in when the saved webpage is read because the interaction relationship between the multiple page data contents is saved; therefore, when a user reads the webpage stored offline, the user can still switch between different page data contents of the webpage through interactive operation with the page data contents.
In addition, the interaction code segment related to the interaction relation in the webpage source code is traversed, so that the webpage storage plug-in can acquire the interaction relation of at least two webpage data contents, the interaction code segment is copied and stored, and the interaction relation of the webpage contents in the webpage can be recovered when the webpage stored offline is read.
In addition, all webpage resources related to the webpage are downloaded, so that all webpage resources stored offline can still be displayed to the user in an offline state or when the resource address fails and the resources cannot be updated.
In addition, by detecting whether or not the web page saving plug-in is installed, it can be determined whether or not the web page can be saved as a predetermined web page file.
In addition, before downloading and installing the webpage saving plug-in, whether the communication network is the first communication network or not is detected, so that the user can download the webpage saving plug-in and the webpage resources in a proper network environment.
After the target webpage is stored offline by the webpage storage method shown in fig. 3A, when a user reads the target webpage stored offline, not only the interaction relationship between the data contents of each page in the target webpage can be reconstructed, but also the webpage resources can be updated under the condition of a communication network, for details, refer to the webpage reading method shown in fig. 4A.
Fig. 4A is a flowchart of a method for reading a web page according to another embodiment of the present invention. In this embodiment, the web page reading method is exemplified by being applied to a terminal having a web page browsing function, and a browser or a third party application having a web page browsing function is installed in the terminal. As shown in fig. 4A, the web page reading method includes:
step 401, acquiring a predetermined webpage file of a target webpage.
Alternatively, the predetermined web page file is an mht file saved by the web page saving method shown in fig. 3A.
In practical application, when reading the saved mht file, it is necessary to determine whether the saved mht file is a predetermined web page file, that is, to identify whether the saved mht file has a predetermined identifier of the predetermined web page file. For example, whether the naming mode of the saved mht file is the naming mode of the predetermined webpage file or not is identified, or whether the icon of the saved mht file is the icon of the predetermined webpage file or not is identified.
If the saved mht file is not the predetermined web page file saved by the web page saving method shown in fig. 3A, the mht file is directly opened in a manner of reading a normal mht file provided in the prior art.
If the saved mht file is a predetermined web page file saved by the web page saving method shown in fig. 3A, step 402 is executed.
Step 402, detecting whether a web page save plug-in has been installed.
In actual implementation, the webpage storage plug-in is a service worker. The service worker provides the ability to perform functions in the background that do not require interaction with the web page, such as the ability to perform offline web page reading functions in the background, independent of the current web page. An independent process for offline web page reading can be created through the service worker. The independent process has the ability to identify and render code that reconstructs the relationships about user interactions.
Since the interactive relationship between the page data contents of the web page can be restored when the target web page is read only by the web page saving plug-in, it is necessary to detect whether the web page saving plug-in is installed.
In step 403, if the webpage saving plug-in is not installed, the webpage saving plug-in is downloaded and installed.
Optionally, similar to steps 303 and 304, before downloading and installing the webpage saving plug-in, it is detected whether the communication network connected to the terminal is the first communication network. The first communication network is a communication network with unlimited download traffic or download cost below a threshold or free use, such as a WiFi network. If the currently connected communication network is the first communication network, downloading and installing a script to insert; and if the currently connected communication network is different from the first communication network, inquiring whether the user agrees to the downloading, and downloading and installing the webpage storage plug-in when the user agrees to the downloading.
In a possible implementation, if the terminal is not connected to the communication network, the installation webpage storage plug-in cannot be downloaded, and because the predetermined webpage file is a mht file with mht as an extension, the target webpage can be read according to a method for opening a common mht file, that is, when the target webpage is read, the interactive relationship of the page data content of the target webpage cannot be recovered.
Step 404, acquiring the web page resources of the target web page, the resource address corresponding to each web page resource and the interaction relationship from the predetermined web page file through the web page saving plug-in.
The target webpage comprises all webpage resources which are used for forming at least two webpage data contents.
The interaction relation is used for indicating switching logic of the page data content when receiving user operation. The switching logic includes switching logic for single page data content and/or switching logic between multiple page data content.
After the webpage saving plug-in is installed, a preset webpage file is read through the webpage saving plug-in, the interaction relation among the webpage resources of the target webpage, the resource address corresponding to each webpage resource and the page data content is obtained, the target webpage can be rendered and reconstructed into a webpage capable of interacting with the user operation, and the user can view all webpage resources related to the target webpage.
Step 405, detecting whether the web page resource needs to be updated according to the resource address corresponding to each web page resource.
Under the condition that the terminal is connected with the communication network, the webpage storage plug-in can detect whether the webpage resources are updated or not according to the resource addresses stored offline.
Optionally, for different types of web resources, when detecting whether the web resource needs to be updated, the adopted methods are also different. For example, when the webpage resource is a video resource, the stored video resource is uploaded 11 months and 10 days, and when the webpage storage plug-in detects that the video resource in the server is uploaded 11 months and 15 days, the video resource is determined to be required to be updated. For another example, when the web page resource is a file resource, the size of the stored file resource is 200KB, and the web page saving plug-in detects that the file resource in the server is 300KB, the file resource is determined to need to be updated. When the web page resource is of other types, a method for detecting whether the web page resource needs to be updated needs to be determined according to actual conditions, and details are not repeated here.
Optionally, if the webpage saving plug-in detects that the webpage resource is not updated, displaying the page data content of the target webpage through the saved webpage resource; if the web page saving plug-in detects that the web page resource is updated, step 406 is entered.
In a possible implementation, when the terminal is not connected to the communication network, the web page saving plug-in cannot update the web page resource, and the web page data content of the target web page is rendered and reconstructed through the web page resource saved offline.
Step 406, if the web page resource needs to be updated, detecting whether the currently connected communication network is the first communication network.
Since the updating of web page resources requires the transmission of data over a communication network. The communication network at least comprises a first communication network and a second communication network, wherein the first communication network is a communication network which does not limit the download flow or has the download cost lower than a threshold value or is used for free, such as a WiFi network, and the second communication network is a communication network which limits the download flow or has the download cost higher than the threshold value, such as a mobile network. The priority of the second communication network is lower than the priority of the first communication network. Therefore, before updating the web resource, it is necessary to detect whether the communication network to which the terminal is connected is the first communication network.
If the currently connected communication network is the first communication network, step 407 is entered; if the currently connected communication network is the second communication network, step 409 is entered.
Step 407, if the currently connected communication network is the first communication network, acquiring the updated web page resource through the resource address.
And step 408, displaying the page data content in the target webpage through the updated webpage resource.
The page data content in the target webpage is displayed through the updated webpage resource, so that the user can read the latest webpage resource.
When the terminal is connected to the second communication network, that is, the communication network for paid use, in order to avoid the user's loss caused by updating the web resource using the second communication network under the condition that the user does not know, the user may be prompted to update through steps 409 to 411, and whether to update the web resource is determined according to the user's selection.
Step 409, if the currently connected communication network is the second communication network, displaying an update request, where the update request is used to request to update the web page resource using the second communication network.
In practical application, when the terminal is connected to the second communication network, a prompt window of the update request is displayed in the terminal screen. For example, as shown in fig. 4B, a prompt window 40 for requesting update is displayed in the terminal screen, and a confirmation control 41 and a cancellation control 42 are displayed in the prompt window 40.
And step 410, when the confirmation operation is received, executing the step of acquiring the updated webpage resource through the resource address.
Corresponding to fig. 4B, when the confirmation control 41 is triggered, and the terminal receives the confirmation operation, the script control updates the web page resource using the second communication network.
In step 411, when a cancel operation is received, displaying the page data content in the target webpage through the webpage resource which is not updated is executed.
Corresponding to fig. 4B, when the cancel control 42 is triggered, and the terminal receives the cancel operation, the script control does not update the web page resource, and displays the page data content in the target web page through the non-updated web page resource, that is, renders and reconstructs the target web page through the stored web page resource.
For the web page reading method in the present embodiment, it can be explained with reference to a schematic diagram of an exemplary web page reading method shown in fig. 4C. S401 is to read the off-line web page, and when the off-line web page is read, S402 needs to be executed to judge whether the target web page is a preset web page file; if the judgment result in the S402 is negative, executing S412, and reading the target webpage by using a common mode, namely a mode of reading a common mht file; if the judgment result of the S402 is yes, executing S403 to detect whether a webpage saving plug-in is installed; if the installation of the webpage saving plug-in is detected in S403, executing S404, and opening the webpage through the webpage resources which are not updated; if the step S403 detects that the webpage saving plug-in is not installed, executing step S405 to detect whether the terminal is connected with a WiFi network, if the step S405 detects that the terminal is connected with the WiFi network, executing step S406 to install the webpage saving plug-in, wherein the webpage saving plug-in is installed by downloading an installation package of the webpage saving plug-in through the WiFi network; after the installation of the webpage saving plug-in is finished in S406, S407 is executed, and the webpage resources are updated, wherein the webpage resources are updated by using a WiFi network; after the web page resource is updated in S407, executing S408, and opening the web page through the updated web page resource; if the WiFi network is not connected in S405, executing S409, and confirming whether the user is willing to consume flow for reading; if the confirmation result of the step S409 is yes, executing step S410, and installing the web page saving plug-in, where the installation package of the web page saving plug-in is downloaded by using the traffic; after the installation of the webpage saving plug-in is finished in the S410, executing the S411 to update the webpage resources, wherein the webpage resources are updated by using the flow; after the webpage resources are updated in S411, executing S408, and opening the webpage through the updated webpage resources; if the result of the determination in S409 is no, S412 is executed to read the web page in a normal manner, i.e., a manner of reading a normal mht file.
In summary, in the webpage reading method provided in the embodiment of the present invention, when the predetermined webpage file is read, the interaction relationship between the page data content and the page data content in the predetermined webpage file is obtained, and the target webpage is reconstructed and rendered into the webpage capable of responding to the user operation. Even if the H5 webpage with strong interactive characteristics is stored, the interactive function of the H5 webpage can be recovered when the H5 webpage stored offline is read, so that the H5 webpage stored offline can respond to the user operation, and the user can still switch to other page data contents through the interactive operation with the page data contents when reading the webpage stored offline.
In addition, whether the webpage resources are updated or not is detected by the webpage storage plug-in according to the offline stored resource address, and whether the webpage resources need to be updated or not can be determined.
In addition, by updating the webpage resources in the target webpage stored offline, when the user reads the target webpage, the user can read the page data content displayed according to the latest webpage resources.
In addition, whether the connected communication network is the first communication network or not is detected before the webpage resources are updated, so that the problem that when the terminal is connected with the second communication network, the webpage resources are updated by using the second communication network to cause user loss can be solved.
In addition, by displaying the update request when it is detected that the terminal is connected to the second communication network, it can be determined whether the web resource needs to be updated according to the selection of the user.
FIG. 5A is a schematic diagram of an implementation environment in accordance with some embodiments of the invention. Illustratively, the implementation environment includes a client 510 of a third-party application, a client 520 of a browser, a web page saving plug-in 522 of the browser, a server 530 of the browser, and a terminal 540.
The terminal 540 is used for installing the client 510 of the third party application and the client 520 of the browser.
The server 530 of the browser is used to provide a client of the browser and a download service of a web page saving plug-in of the browser.
The terminal 540 is connected to the server 530 of the browser via a communication network. Optionally, the communication network includes a wired network and a wireless network.
The client 520 of the browser is installed with a web page saving plug-in 522 of the browser, and the web page saving plug-in 522 of the browser is a program running in a background process of the browser, and can realize functions of saving a web page offline and reading the web page saved offline.
The client 510 of the third party application is provided with web browsing functionality. The third party application and the browser have a cooperative relationship, and the client 510 of the third party application can call the web page saving plug-in 522 of the browser to save the web page offline or read the web page.
When the client 520 of the browser is not installed on the terminal 540, if the client 510 of the third-party application needs to store the web page offline or read the web page stored offline, the client 510 of the third-party application requests the installation package of the client 520 of the browser from the server 530 of the browser through the terminal 540, and optionally, the server 530 of the browser sends the installation packages of the client 520 of the browser and the web page storage plug-in 522 of the browser to the terminal 540 at the same time. After the browser client 520 and the browser webpage saving plug-in 522 are downloaded and installed, the third party application client 510 may call the webpage saving plug-in 522 in the browser client 520 to save or read the webpage offline.
Optionally, when the web page saving plug-in 522 of the browser is not installed in the client 520 of the browser, if the client 510 of the third party application needs to save the web page offline or read the web page saved offline, the client 510 of the third party application requests the server 530 of the browser for the installation package of the web page saving plug-in 522 of the browser through the terminal 540. After the web page saving plug-in 522 of the browser is downloaded and installed, the client 510 of the third party application may call the web page saving plug-in 522 of the client 520 of the browser to save or read the web page offline.
In a possible implementation manner, the third-party application corresponds to a webpage saving plug-in of the third-party application, and after the client 510 of the third-party application downloads the webpage saving plug-in which the third-party application is installed, the client 510 of the third-party application can expand the functions of saving the webpage offline and reading the webpage saved offline without calling the webpage saving plug-in 522 of the browser.
Fig. 5B is a schematic diagram of a web page saving process according to some embodiments of the present invention. Schematically, the present embodiment is applied in the implementation environment shown in fig. 5A.
As shown in fig. 5A, when the user browses a web page 541 using a third party application a on the terminal 540 and needs to save the web page 541 offline, a menu item 543 containing "download to local" and/or "save to browser" may be displayed by triggering a pull-down menu control 542. When any menu item 543 of "download to local" or "save to browser" is triggered, the third party application a detects whether the terminal 540 installs a browser (i.e. the client 520 of the browser shown in fig. 5A), and if the terminal 540 has installed a browser, which corresponds to S51 in fig. 5B, calls the browser to save the web page 541 offline through the third party application a. During the offline saving process, a prompt message 544 of "web page saving" is displayed on the screen, and a path 545 of offline saving is prompted, for example, "you can view in a file download-a file," where the a file corresponds to the third party application a, and the a file stores various types of files saved by the third party application a.
When the web page 541 is successfully saved offline, a shortcut 570 of the a-file may be created on the desktop in order to enable the user to quickly access the web page 541 saved offline. Optionally, before creating the shortcut 570 of the a-file, a shortcut creation prompt 550 is displayed on the screen, and the terminal 540 creates the shortcut 570 of the a-file on the desktop after receiving the confirmation operation, i.e., when the confirmation control 551 on the shortcut creation prompt 550 is triggered. If the cancel control 552 on the shortcut creation prompt 550 is triggered, the shortcut 570 for the a-file is not created on the desktop.
If the third-party application a detects that the terminal 540 does not install the browser, which corresponds to S52 in fig. 5B, a prompt link 560 for installing the browser is displayed on the screen, and when receiving an operation of confirming installation by the user, that is, when the immediate installation control 561 is triggered, the third-party application a requests the server 530 of the browser shown in fig. 5A for an installation package of the client 520 of the browser to download the client 520 of the browser. After the browser is successfully installed, third party application a invokes the browser to save web page 541 offline, as indicated at S53.
After the terminal stores the web page offline through the process shown in fig. 5B, the user may find the mht file corresponding to the web page 541 stored offline according to the process shown in fig. 5C.
Fig. 5C is a schematic diagram of a web page reading process according to some embodiments of the invention. Schematically, the present embodiment is applied in the implementation environment shown in fig. 5A.
Optionally, when the user needs to read the offline-saved web page 541, the mht file 591 of the offline-saved web page 541 can be found in two ways. One way is that according to the off-line saving path 545 prompted during off-line saving, a file download folder 580 is opened, then an a file folder 590 is opened, a mht file 591 of the off-line saved webpage 541 is found, and the off-line saved webpage 541 can be read by opening the mht file 591; another way is to directly open the "a file" folder 590 by the a file shortcut 570 created on the desktop, find the mht file 591 of the web page 541 stored offline, and then read the web page 541 stored offline, as shown in fig. 5B, on the premise that the a file shortcut 570 is created when the web page 541 is stored offline. The method for rendering and reconstructing the mht file into the webpage can refer to the steps shown in fig. 2 or fig. 4A.
Fig. 6 is a block diagram illustrating a structure of a web page saving apparatus according to an embodiment of the present invention. The present embodiment is exemplified by applying the web page saving device to a terminal having a web page browsing function. As shown in fig. 6, the web page saving apparatus includes: a receiving module 610, an obtaining module 620 and a saving module 630.
A receiving module 610, configured to implement the above step 101, step 301, and any other implicit or public functions related to the receiving step.
An obtaining module 620, configured to implement the foregoing step 102 and any other implicit or disclosed functionality related to the obtaining step.
A saving module 630, configured to implement the foregoing step 103 and any other implicit or disclosed functions related to the saving step.
Optionally, the obtaining module 620 includes: the device comprises a first acquisition unit and a traversal unit.
A first obtaining unit, configured to implement the above step 305 and any other implicit or disclosed functions related to the obtaining step.
A traversal unit for implementing the step 306 and any other implicit or disclosed functions related to the traversal step.
Optionally, the saving module 530 includes: the device comprises a second acquisition unit, a downloading unit and a storage unit.
A second obtaining unit, configured to implement the above step 307 and any other implicit or disclosed functions related to the obtaining step.
A download unit for performing the above step 308 and any other implicit or disclosed functions related to the download step.
A saving unit for implementing the above step 309 and any other implicit or disclosed functions related to the saving step.
Optionally, the apparatus further comprises: the device comprises a first detection module, a download module and a second detection module.
A first detection module for implementing the above step 302 and any other implicit or disclosed functions related to the detection step.
A download module for performing the above step 304 and any other implicit or disclosed functionality associated with the download step.
A second detection module for implementing the above step 303 and any other implicit or disclosed functions related to the detection step.
In summary, in the webpage saving method provided in the embodiment of the present invention, the webpage saving plug-in saves the interaction relationship between the multiple page data contents of the webpage and the multiple page data contents as the predetermined webpage file, and the interaction relationship between the multiple page data contents can be restored by the webpage saving plug-in when the saved webpage is read because the interaction relationship between the multiple page data contents is saved; therefore, when a user reads the webpage stored offline, the user can still switch between different page data contents of the webpage through interactive operation with the page data contents.
It should be noted that: the web page saving device provided in the above embodiment only exemplifies the division of the above functional modules when saving a web page, and in practical applications, the above function distribution may be completed by different functional modules as needed, that is, the internal structure of the terminal is divided into different functional modules to complete all or part of the above described functions. In addition, the web page saving device and the web page saving method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Fig. 7 is a block diagram illustrating a structure of a web page reading apparatus according to an embodiment of the present invention. The present embodiment is exemplified by applying the web page reading apparatus to a terminal having a web page browsing function. As shown in fig. 7, the web page reading apparatus includes: a first obtaining module 710, a second obtaining module 720, a first displaying module 730 and a switching module 740.
A first obtaining module 710, configured to implement the above step 201, step 401, and any other implicit or disclosed functions related to the obtaining step.
A second obtaining module 720, configured to implement the above step 202, step 404, and any other implicit or disclosed functions related to the obtaining step.
A first display module 730, configured to implement the above step 203, step 411, and any other implicit or public functions related to the display step.
A handover module 740 configured to implement the aforementioned step 204 and any other implicit or disclosed functionality associated with the handover step.
Optionally, the first display module 730 includes: the device comprises a detection unit, an updating unit and a display unit.
A detection unit for implementing the above step 405 and any other implicit or disclosed functions related to the detection step.
An updating unit, configured to implement the above step 407, step 410, and any other implicit or public functions related to the updating step.
A display unit for implementing the above step 408 and any other implicit or disclosed functions related to the displaying step.
Optionally, the apparatus further comprises: the device comprises a first detection module, a second display module, a second detection module and a downloading module.
A first detection module for implementing the above step 406 and any other implicit or disclosed functions related to the detection step.
A second display module, configured to implement the above step 409 and any other implicit or disclosed functions related to the display step.
A second detection module for implementing the above step 402 and any other implicit or disclosed functions related to the detection step.
A download module for implementing the above step 403 and any other implicit or disclosed functions related to the download step.
In summary, the webpage reading apparatus provided in the embodiment of the present invention obtains the interaction relationship between the page data content and the page data content in the predetermined webpage file when reading the predetermined webpage file, and renders the target webpage into a webpage capable of responding to the user operation. Even if the H5 webpage with strong interactive characteristics is stored, the interactive function of the H5 webpage can be recovered when the H5 webpage stored offline is read, so that the H5 webpage stored offline can respond to the user operation, and the user can still switch to other page data contents through the interactive operation with the page data contents when reading the webpage stored offline.
It should be noted that: the web page reading apparatus provided in the above embodiment only exemplifies the division of the above functional modules when reading a web page, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the terminal is divided into different functional modules to complete all or part of the above described functions. In addition, the web page reading apparatus and the web page reading method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Referring to fig. 8, a block diagram of a hardware device according to some embodiments of the present invention is shown. The apparatus 800 is used to implement the web page saving method or the web page reading method provided by the above embodiments. The apparatus 800 of the present invention may include one or more of the following components: a processor for executing computer program instructions to perform the various processes and methods, Random Access Memory (RAM) and Read Only Memory (ROM) for information and storing program instructions, memory for storing data and information, I/O devices, interfaces, antennas, and the like. Specifically, the method comprises the following steps:
the apparatus 800 may include RF (Radio Frequency) circuitry 810, a memory 820, an input unit 830, a display unit 840, a sensor 850, audio circuitry 860, a WiFi (wireless fidelity) module 870, a processor 880, a power source 882, a camera 890, and the like. Those skilled in the art will appreciate that the arrangement of apparatus illustrated in fig. 8 is not intended to be limiting and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components.
The various components of the apparatus 800 are described in detail below with reference to fig. 8:
the RF circuit 810 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, for processing downlink information of a base station after receiving the downlink information to the processor 880; in addition, the data for designing uplink is transmitted to the base station. Typically, the RF circuit includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, and the like. In addition, the RF circuit 810 may also communicate with networks and other devices via wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communications), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), email, SMS (Short Messaging Service), and the like.
The memory 820 may be used to store software programs and modules, and the processor 880 executes various functional applications and data processing of the apparatus 800 by operating the software programs and modules stored in the memory 820. The memory 820 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the apparatus 800, and the like. Further, the memory 820 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 830 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the device 800. Specifically, the input unit 830 may include a touch panel 831 and other input devices 832. The touch panel 831, also referred to as a touch screen, can collect touch operations performed by a user on or near the touch panel 831 (e.g., operations performed by the user on the touch panel 831 or near the touch panel 831 using any suitable object or accessory such as a finger, a stylus, etc.) and drive the corresponding connection device according to a preset program. Alternatively, the touch panel 831 may include two portions, i.e., a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts it to touch point coordinates, and sends the touch point coordinates to the processor 880, and can receive and execute commands from the processor 880. In addition, the touch panel 831 may be implemented by various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 830 may include other input devices 832 in addition to the touch panel 831. In particular, other input devices 832 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 840 may be used to display information input by a user or information provided to the user and various menus of the apparatus 800. The Display unit 840 may include a Display panel 841, and the Display panel 841 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like, as an option. Further, touch panel 831 can overlay display panel 841, and when touch panel 831 detects a touch operation thereon or nearby, communicate to processor 880 to determine the type of touch event, and processor 880 can then provide a corresponding visual output on display panel 841 based on the type of touch event. Although in fig. 8, the touch panel 831 and the display panel 841 are two separate components to implement the input and output functions of the device 800, in some embodiments, the touch panel 831 and the display panel 841 may be integrated to implement the input and output functions of the device 800.
The device 800 may also include at least one sensor 850, such as a gyroscope sensor, a magnetic induction sensor, an optical sensor, a motion sensor, and others. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel 841 based on the brightness of ambient light, and a proximity sensor that may turn off the display panel 841 and/or backlight when the device 800 is moved to the ear. As one type of motion sensor, the acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), detect the magnitude and direction of gravity when stationary, and can be used for applications (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration) for recognizing the attitude of electronic equipment, and related functions (such as pedometer and tapping) for vibration recognition; other sensors such as barometers, hygrometers, thermometers, infrared sensors, etc. may also be configured with the device 800 and will not be described further herein.
The audio circuitry 860, speaker 861, microphone 862 may provide an audio interface between a user and the device 800. The audio circuit 860 can transmit the electrical signal converted from the received audio data to the speaker 861, and the electrical signal is converted into a sound signal by the speaker 861 and output; on the other hand, the microphone 862 converts the collected sound signal into an electric signal, converts the electric signal into audio data after being received by the audio circuit 860, and outputs the audio data to the processor 880 for processing, and then transmits the audio data to, for example, another terminal via the RF circuit 810, or outputs the audio data to the memory 820 for further processing.
WiFi belongs to short-range wireless transmission technology, and the apparatus 800 can help the user send and receive e-mail, browse web page, and access streaming media, etc. through the WiFi module 870, which provides the user with wireless broadband internet access. Although fig. 8 shows WiFi module 870, it is understood that it does not belong to the essential components of apparatus 800 and may be omitted entirely as needed within the scope of not changing the nature of the disclosure.
The processor 880 is a control center of the apparatus 800, connects various parts of the entire electronic device using various interfaces and lines, performs various functions of the apparatus 800 and processes data by operating or executing software programs and/or modules stored in the memory 820 and calling data stored in the memory 820, thereby performing overall monitoring of the electronic device. Optionally, processor 880 may include one or more processing units; preferably, the processor 880 may integrate an application processor, which mainly handles operating systems, user interfaces, applications, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 880.
The apparatus 800 further includes a power source 882 (e.g., a battery) for supplying power to the various components, which may preferably be logically coupled to the processor 880 via a power management system to manage charging, discharging, and power consumption management functions via the power management system.
The camera 890 is generally composed of a lens, an image sensor, an interface, a digital signal processor, a CPU, a display screen, and the like. The lens is fixed above the image sensor, and the focusing can be changed by manually adjusting the lens; the image sensor is equivalent to the 'film' of a traditional camera and is the heart of a camera for acquiring images; the interface is used for connecting the camera with a mainboard of the electronic equipment by using a flat cable, a board-to-board connector and a spring type connection mode and sending the acquired image to the memory 820; the digital signal processor processes the acquired image through a mathematical operation, converts the acquired analog image into a digital image, and transmits the digital image to the memory 820 through an interface.
Although not shown, the apparatus 800 may further include a bluetooth module, etc., which will not be described herein.
The apparatus 800 includes, in addition to the one or more processors 880, memory, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the one or more processors.
An embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium may be a computer-readable storage medium contained in the memory in the foregoing embodiment; or it may be a separate computer-readable storage medium not incorporated in the terminal. The computer-readable storage medium stores one or more programs, and the one or more programs are used by one or more processors to execute the web page saving method or the web page reading method.
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 will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (18)

1. A webpage saving method is characterized in that the method is applied to a third-party application program, the third-party application program is provided with a webpage saving plug-in serviceworker, and the method comprises the following steps:
receiving an offline storage instruction of a target webpage, wherein the target webpage switches different page data contents when receiving user operation, and the page data contents are one of a plurality of page data contents contained in the target webpage;
acquiring a webpage source code of the target webpage through the service worker;
traversing interactive code segments related to interactive relations in the webpage source code through the service worker, and storing the interactive relations of at least two page data contents by copying the interactive code segments, wherein the interactive relations are used for indicating switching logics of the page data contents when the user operation is received, and the switching logics comprise switching logics among a plurality of page data contents;
acquiring a resource address from the webpage source code through the service worker;
downloading all webpage resources of the target webpage from the resource address through the service worker, wherein the webpage resources comprise resources for forming at least two page data contents;
and storing the webpage resources, the resource addresses corresponding to the webpage resources and the interaction relationship into a mht file with mht as an extension name through the service worker, wherein the mht file is added with a preset identifier and used for indicating that the mht file stored offline at this time is stored through the service worker, and the mht file stores the webpage resources required by each webpage data content, the resource addresses corresponding to the webpage resources and the interaction relationship between at least two webpage data contents.
2. The method of claim 1, wherein before traversing the interactive code segment related to the interactive relationship in the web page source code through the service worker, the method further comprises:
detecting whether the service worker is installed or not;
and if the service worker is not installed, downloading and installing the service worker.
3. The method of claim 2, further comprising, prior to said downloading and installing said service worker:
detecting whether a currently connected communication network is a first communication network;
and if the currently connected communication network is the first communication network, executing the step of downloading and installing the service worker.
4. A method for reading a web page, the method comprising:
acquiring a preset webpage file of a target webpage, wherein the preset webpage file is a mht file with mht as an extension name, the mht file comprises all webpage resources of the target webpage, a resource address corresponding to each webpage resource and an interactive relation, the interactive relation is used for indicating switching logic of the page data content of the target webpage when user operation is received, the switching logic comprises switching logic among a plurality of page data contents, and a preset identifier is added to the mht file and is used for indicating that the mht file stored offline at this time is stored through a serviceworker;
acquiring the webpage resource, the resource address and the interaction relationship from the preset webpage file through the service worker, wherein the webpage resource comprises resources for forming at least two page data contents, the interaction relationship is obtained by copying an interaction code segment, and the interaction code segment is obtained by traversing a webpage source code of the target webpage through the service worker;
displaying the page data content in the target webpage, wherein the page data content is one of a plurality of page data contents contained in the target webpage;
and when user operation is received, switching the page data content according to the interactive relation of the at least two page data contents.
5. The method of claim 4, wherein the displaying the page data content in the target web page comprises:
detecting whether the webpage resources need to be updated or not according to the resource address corresponding to each webpage resource;
if the webpage resource needs to be updated, acquiring the updated webpage resource through the resource address;
and displaying the page data content in the target webpage through the updated webpage resource.
6. The method of claim 5, wherein before the obtaining the updated web page resource through the resource address, further comprising:
detecting whether a currently connected communication network is a first communication network;
and if the currently connected communication network is the first communication network, executing the step of acquiring the updated webpage resource through the resource address.
7. The method of claim 6, wherein after the detecting whether the currently connected communication network is the first communication network, further comprising:
if the currently connected communication network is a second communication network, displaying an updating request, wherein the updating request is used for requesting to update the webpage resources by using the second communication network;
when receiving the confirmation operation, executing the step of acquiring the updated webpage resource through the resource address;
wherein the priority of the second communication network is lower than the priority of the first communication network.
8. The method according to any one of claims 4 to 7, wherein before the obtaining the web resource, the resource address and the interaction relationship from the predetermined web file by the service worker, the method further comprises:
detecting whether the service worker is installed or not;
and if the webpage storage plug-in is not installed, downloading and installing the service worker.
9. An apparatus for saving a web page, the apparatus comprising:
the device comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving an offline storage instruction of a target webpage, and when the target webpage receives user operation, different page data contents are switched, and the page data contents are one of a plurality of page data contents contained in the target webpage;
the first acquisition unit is used for acquiring a webpage source code of the target webpage through a service worker;
a traversal unit, configured to traverse, by the service worker, an interaction code segment related to an interaction relationship in the web page source code acquired by the first acquisition unit, and store the interaction relationship between at least two page data contents by copying the interaction code segment, where the interaction relationship is used to indicate a switching logic of the page data contents when the user operation is received, and the switching logic includes switching logics between a plurality of page data contents;
a second obtaining unit, configured to obtain, by the service worker, a resource address from the web page source code obtained by the first obtaining unit;
a downloading unit, configured to download, through the service worker, all web page resources of the target web page from the resource address acquired by the second acquiring unit, where the web page resources include resources used for forming the at least two page data contents;
and the storage unit is used for storing the webpage resources, the resource addresses corresponding to the webpage resources and the interaction relationship into a mht file with mht as an extension name through the service worker, the mht file is added with a preset identifier and used for indicating that the mht file stored offline at this time is stored through the service worker, and the mht file stores the webpage resources required by the data content of each page, the resource addresses corresponding to the webpage resources and the interaction relationship between the data content of at least two pages.
10. The apparatus of claim 9, further comprising:
the first detection module is used for detecting whether the service worker is installed or not;
and the downloading module is used for downloading and installing the webpage storage plug-in if the first detection module detects that the service worker is not installed.
11. The apparatus of claim 10, further comprising:
the second detection module is used for detecting whether the currently connected communication network is the first communication network;
the downloading module is further configured to execute the step of downloading and installing the service worker if the second detection module detects that the currently connected communication network is the first communication network.
12. A web page reading apparatus, characterized in that the apparatus comprises:
the system comprises a first acquisition module, a first storage module and a second storage module, wherein the first acquisition module is used for acquiring a preset webpage file of a target webpage, the preset webpage file is a mht file with mht as an extension, the mht file comprises all webpage resources of the target webpage, and a resource address and an interactive relation corresponding to each webpage resource, the interactive relation is used for indicating a switching logic of the page data content of the target webpage when a user operation is received, the switching logic comprises a switching logic among a plurality of page data contents, and the mht file is added with a preset identifier and used for indicating that the mht file stored offline at this time is stored through a serviceworker;
a second obtaining module, configured to obtain, from the predetermined web page file through the service worker, the web page resource, the resource address, and the interaction relationship, where the web page resource includes a resource used to form at least two page data contents, the interaction relationship is obtained by copying an interaction code segment, and the interaction code segment is obtained by traversing a web source code of the target web page through the service worker;
a first display module, configured to display the page data content in the target webpage, where the page data content is one of a plurality of page data contents included in the target webpage;
and the switching module is used for switching the page data contents displayed by the first display module according to the interactive relationship of the at least two page data contents when user operation is received.
13. The apparatus of claim 12, wherein the first display module comprises:
the detection unit is used for detecting whether the webpage resources need to be updated or not according to the resource address corresponding to each webpage resource;
the updating unit is used for acquiring the updated webpage resource through the resource address if the webpage resource needs to be updated;
and the display unit is used for displaying the page data content in the target webpage through the updated webpage resource.
14. The apparatus of claim 13, further comprising:
the first detection module is used for detecting whether the currently connected communication network is a first communication network;
the updating unit is further configured to execute the step of obtaining the updated web resource through the resource address if the first detection module detects that the currently connected communication network is the first communication network.
15. The apparatus of claim 14, further comprising:
a second display module, configured to display an update request if the first detection module detects that the currently connected communication network is a second communication network, where the update request is used to request to update the web resource using the second communication network;
the updating unit is further configured to execute the step of acquiring the updated webpage resource through the resource address when receiving the confirmation operation;
wherein the priority of the second communication network is lower than the priority of the first communication network.
16. The apparatus of any one of claims 12 to 15, further comprising:
the second detection module is used for detecting whether the service worker is installed or not;
and the downloading module is used for downloading and installing the service worker if the second detection module detects that the service worker is not installed.
17. An apparatus comprising one or more processors, memory, and one or more programs stored in the memory configured to perform the web page saving method of any of claims 1 to 3 or the web page reading method of any of claims 4 to 8 by the one or more processors.
18. A computer readable storage medium storing one or more programs, the one or more programs being used by one or more processors to perform the web page saving method according to any one of claims 1 to 3 or the web page reading method according to any one of claims 4 to 8.
CN201611105483.7A 2016-12-05 2016-12-05 Webpage storage method, webpage reading method and device Active CN108153778B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611105483.7A CN108153778B (en) 2016-12-05 2016-12-05 Webpage storage method, webpage reading method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611105483.7A CN108153778B (en) 2016-12-05 2016-12-05 Webpage storage method, webpage reading method and device

Publications (2)

Publication Number Publication Date
CN108153778A CN108153778A (en) 2018-06-12
CN108153778B true CN108153778B (en) 2021-05-14

Family

ID=62470059

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611105483.7A Active CN108153778B (en) 2016-12-05 2016-12-05 Webpage storage method, webpage reading method and device

Country Status (1)

Country Link
CN (1) CN108153778B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108920645A (en) * 2018-06-29 2018-11-30 广州视源电子科技股份有限公司 Method, apparatus, smart machine and the storage medium that the smart machine page is shown
CN110858114B (en) * 2018-08-22 2021-12-10 北京字节跳动网络技术有限公司 Webpage display method, bookmark generation method, device, equipment and medium on mobile terminal
CN111316618B (en) * 2018-10-11 2021-11-30 华为技术有限公司 Network page storage method and terminal
CN110471887A (en) * 2019-07-29 2019-11-19 深圳数位传媒科技有限公司 A kind of method and device obtaining web page contents rendering file
CN111245890B (en) * 2019-12-25 2022-08-02 曙光信息产业(北京)有限公司 Method and device for downloading files in webpage
CN112632425B (en) * 2020-12-10 2024-02-06 京东科技控股股份有限公司 Method, device, equipment and storage medium for generating offline resource file
CN113051502A (en) * 2021-03-11 2021-06-29 北京顶象技术有限公司 Webpage saving method, device, equipment and storage medium
CN115982499B (en) * 2022-12-27 2024-04-05 中国电子产业工程有限公司 Page storage method, device, equipment and storage medium
CN116467037B (en) * 2023-06-09 2023-09-22 成都融见软件科技有限公司 Graphic user interface work state recovery method

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8117303B2 (en) * 2007-06-29 2012-02-14 Nokia Corporation Systems, methods, devices, and computer program products for downloading content for offline browsing
KR101498920B1 (en) * 2010-08-16 2015-03-06 에스케이플래닛 주식회사 Web page pre-caching system and method for offline-executing
CN102457499B (en) * 2010-10-26 2015-09-16 腾讯科技(深圳)有限公司 The method that works offline of client and the client that works offline
CN103873502A (en) * 2012-12-11 2014-06-18 阿里巴巴集团控股有限公司 Cache updating method and system, and update resource providing method and system
CN103699674B (en) * 2013-12-31 2018-04-13 优视科技有限公司 Webpage preservation, webpage deployment method and device and Web browsing system

Also Published As

Publication number Publication date
CN108153778A (en) 2018-06-12

Similar Documents

Publication Publication Date Title
CN108153778B (en) Webpage storage method, webpage reading method and device
CN107040609B (en) Network request processing method and device
JP6461173B2 (en) Message withdrawal method and apparatus
CN109857403B (en) Page updating method and device, page processing method and device
KR20180094088A (en) Graphic code display method and apparatus
CN109309696B (en) Folder transmission method, sender, receiver, and storage medium
CN106775828B (en) Application program installation method and device and computer equipment
WO2013182063A1 (en) Webapp startup method and device
CN110020293B (en) Multimedia data display method, device and storage medium
CN108270870B (en) Prompt message pushing method and device
CN108124016B (en) Method and device for sending POST (POST on POST) request
CN109739402B (en) Fast application processing method and terminal equipment
CN108491148B (en) Application sharing method and terminal
CN107666406B (en) Intelligent card display method and device
CN106953898B (en) Method and device for acquiring software package
WO2014173167A1 (en) Method, apparatus and system for filtering data of web page
US9582584B2 (en) Method, apparatus and system for filtering data of web page
CN108073647B (en) Webpage display method and device
CN104978183A (en) Icon construction method, and terminal equipment
CN109189303B (en) Text editing method and mobile terminal
EP2869604B1 (en) Method, apparatus and device for processing a mobile terminal resource
CN109040339B (en) Cross-domain request processing method, device and equipment based on AJAX
CN104239332A (en) Webpage content processing method, webpage content processing device and browser client side
CN107967153B (en) Application program management method and mobile terminal
CN111124753A (en) Application program control method, electronic equipment and server

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