Webpage information storage method and equipmentTechnical Field
The invention relates to the technical field of computers, in particular to a method and equipment for storing webpage information.
Background
With the increase of the amount of network information, the network provides more webpage information for users and simultaneously increases the difficulty of the users in retrieving the webpage information. Therefore, how to store the web page information retrieved by the user so that the user can obtain the web page information next time becomes one of the most important research topics in the present stage.
The existing storage method of webpage information comprises the following steps: the method comprises the steps of displaying the page content of the current webpage acquired by a browser to a user, if the user needs to store the page content, manually copying the page content to a clipboard, creating and opening a text file, and pasting the page content prestored in the clipboard into the text file, so that the webpage information is stored.
In the process of implementing the invention, the inventor finds that the prior art has at least the following problems:
the existing webpage storage method needs to copy the page content into the clipboard, namely, the page content is cached into the memory, so that the memory occupation of the system is increased, and the memory resource of the system is wasted.
Disclosure of Invention
In order to solve the problems that the existing storage method of the webpage information caches the webpage content in the memory, the memory occupation amount of the system is increased, and the memory resource of the system is wasted, the embodiment of the invention provides a storage method and equipment of the webpage information. The technical scheme is as follows:
in one aspect, the present invention provides a method for storing web page information, which is used in an electronic device including a browser, and includes:
selecting page content to be stored in the current webpage through the browser;
receiving a trigger signal for opening a text file through the browser;
opening the text file through the browser, wherein the text file is opened by the browser according to the trigger signal;
storing the page content in the text file through the browser.
In another aspect, the present invention provides an electronic device including a browser, the device comprising:
the selection module is used for selecting the page content to be stored in the current webpage through the browser;
the first receiving module is used for receiving a trigger signal for opening a text file through the browser;
the opening module is used for opening the text file through the browser, and the text file is opened by the browser according to the trigger signal received by the first receiving module;
and the storage module is used for storing the page content selected by the selection module in the text file opened by the opening module through the browser.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
selecting page content to be stored in the current webpage through the browser; receiving a trigger signal for opening a text file through the browser; opening the text file through the browser, wherein the text file is opened by the browser according to the trigger signal; the page content is stored in the text file through the browser, so that the problems that the page content is cached in a memory by the existing webpage information storage method, the memory occupation amount of a system is increased, and the memory resource of the system is wasted are solved, and the effect of saving the memory resource of the system is achieved.
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 flowchart of a method for storing web page information according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for storing web page information according to a second embodiment of the present invention;
fig. 3 is a flowchart of a method for storing web page information according to a third embodiment of the present invention;
FIG. 4 is a schematic diagram of an application of storing web page information of multiple web pages according to a third embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to a fifth 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.
Example one
Referring to fig. 1, a flowchart of a method for storing web page information according to an embodiment of the present invention is shown, where the method for storing web page information may be applied to an electronic device including a browser, where the electronic device may be a smart television, a smart phone, or a tablet computer. The storage method of the webpage information comprises the following steps:
step 101, selecting page content to be stored in a current webpage through a browser;
if the user needs to store the page content displayed in the current webpage, the page content needing to be stored can be selected, the page content can be characters, pictures or videos, and the like, and the page content is not limited in this embodiment. Additionally, the page content may be all or part of the display content of the web page.
Specifically, the selection manner of the page content may be dragging mouse selection or finger clicking selection, and the present embodiment is not limited.
102, receiving a trigger signal for opening a text file through a browser;
if the user needs to store the page content in the current webpage, a trigger signal for opening the text file can be sent to the browser, so that the browser can open the text file according to the trigger signal.
Step 103, opening a text file through a browser, wherein the text file is opened by the browser according to a trigger signal;
and 104, storing the page content in a text file through the browser.
Specifically, the pre-selected page content may be stored in an open text file by the browser.
In summary, in the method for storing webpage information provided by the embodiment of the present invention, the browser selects the content of the page to be stored in the current webpage; receiving a trigger signal for opening a text file through the browser; opening the text file through the browser, wherein the text file is opened by the browser according to the trigger signal; the page content is stored in the text file through the browser, so that the problems that the page content is cached in a memory by the existing webpage information storage method, the memory occupation amount of a system is increased, and the memory resource of the system is wasted are solved, and the effect of saving the memory resource of the system is achieved.
Example two
Referring to fig. 2, a flowchart of a method for storing webpage information according to a second embodiment of the present invention is shown, which is different from the first embodiment in that the present embodiment can store page contents according to a file format of a text file. The method for storing the webpage information can be applied to an electronic device comprising a browser, wherein the electronic device can be a smart television, a smart phone or a tablet computer and the like. The storage method of the webpage information comprises the following steps:
step 201, selecting page content to be stored in a current webpage through a browser;
if the user needs to store the page content displayed in the current webpage, the page content needing to be stored can be selected, the page content can be characters, pictures or videos, and the like, and the page content is not limited in this embodiment. Additionally, the page content may be all or part of the display content of the web page.
Specifically, the selection manner of the page content may be dragging mouse selection or finger clicking selection, and the present embodiment is not limited.
Step 202, receiving a trigger signal for opening a text file through a browser;
if the user needs to store the page content in the current webpage, a trigger signal for opening the text file can be sent to the browser, so that the browser can open the text file according to the trigger signal.
In practical applications, a menu item for generating a trigger signal, such as "insert into text" or the like, may be added in advance to a menu of the browser, and if the user selects the menu item, it is determined that the trigger signal is received.
Step 203, displaying the file formats of the text files through a browser, wherein the file formats are displayed by the browser according to the trigger signal and the file formats are at least one;
because the page content may include characters, pictures, videos, or the like, and accordingly, the coding method of the page content may be various, and the text file does not necessarily support all coding methods, a text file of at least one file format may also be developed, so that the web content is stored in the text file supporting the coding method according to the coding method, thereby expanding the storage range of the page content. The file format may be txt format or doc format, and the embodiment is not limited.
In particular, all file formats supported by the browser may be presented by the browser, so that the user selects the correct file format among all the presented file formats according to the encoding format of the page content to be stored.
Step 204, receiving a first selection signal for determining a file format through a browser;
if the user determines the text format corresponding to the encoding mode of the page content, the correct text format can be selected from the displayed file formats; if the user does not determine the text format corresponding to the encoding mode of the page content, the corresponding relationship between the encoding mode and the file format can be preset, so that the user can select the correct file format from the displayed file formats according to the corresponding relationship.
Step 205, determining a file format through the browser, wherein the file format is determined by the browser according to the first selection signal;
in this embodiment, the file format corresponding to the first selection signal may be determined by a browser, so that a text file corresponding to the file format is opened by the browser.
Step 206, creating and opening a text file corresponding to the file format through the browser;
because there is no text file corresponding to the file format currently, before the text file is opened, a new text file corresponding to the file format needs to be created through the browser. Specifically, a text file may be created through a dedicated API (Application Programming Interface) in the browser, and after the creation is completed, the text file is opened through the API. For example, the dedicated API may be a Filereader API in HTML (Hypertext markup language) 5 or the like.
Step 207, the page content is stored in the text file by the browser.
Specifically, storing the page content in the text file through the browser may include:
the page content is stored in a text file through a dedicated interface in the browser.
Preferably, the pre-selected page content may be stored in a text file opened by the browser through the dedicated interface. Wherein the proprietary interface may be the proprietary API interface in step 206.
Furthermore, the source information of the page content can be identified, so that the user can search the content related to the page content according to the source, or the credibility of the page content is determined according to the source. The source information for identifying the source of the page content may be a web page address of a web page to which the page content belongs, or may be other identification information, which is not limited in this embodiment.
If the source information is a web page address, storing the page content in a text file through a browser may include:
acquiring a webpage address of a current webpage through a browser;
storing the web page address in a text file through a browser;
and storing the page content in a position corresponding to the webpage address in the text file through the browser.
The web address of the current page may be obtained through a browser, which is the prior art and is not described in detail in this embodiment.
After the browser obtains the web page address, the web page address may be stored in a text file, and the page content may be stored at a location corresponding to the web page address. For example, the web page address is stored before or after the page content, and the embodiment is not limited.
It should be noted that after the page content is stored in the text file, the browser may also perform operations such as viewing and modifying on the text file, or the browser may store the page content locally, so as to improve the utilization efficiency of the text file.
In summary, in the method for storing webpage information provided by the embodiment of the present invention, the browser selects the content of the page to be stored in the current webpage; receiving a trigger signal for opening a text file through the browser; opening the text file through the browser, wherein the text file is opened by the browser according to the trigger signal; the page content is stored in the text file through the browser, so that the problems that the page content is cached in a memory by the existing webpage information storage method, the memory occupation amount of a system is increased, and the memory resource of the system is wasted are solved, and the effect of saving the memory resource of the system is achieved. In addition, displaying the file format of the text file through a browser; receiving a first selection signal for determining a file format through a browser; determining a file format through the browser, wherein the file format is determined by the browser according to the first selection signal; the page contents of various encoding modes in the webpage can be correspondingly stored in the text file of the corresponding file format, the problem that the file format does not support the storage of the page contents of a specific encoding mode is solved, and the effect of expanding the storage range of the page contents is achieved.
EXAMPLE III
Please refer to fig. 3, which is a flowchart illustrating a method for storing webpage information according to a third embodiment of the present invention, and the difference between the first embodiment and the second embodiment is that the present embodiment can store the page contents of multiple webpages in the same text file. The method for storing the webpage information can be applied to an electronic device comprising a browser, wherein the electronic device can be a smart television, a smart phone or a tablet computer and the like. The storage method of the webpage information comprises the following steps:
301, selecting page content to be stored in a current webpage through a browser;
if the user needs to store the page content displayed in the current webpage, the page content needing to be stored can be selected, the page content can be characters, pictures or videos, and the like, and the page content is not limited in this embodiment. Additionally, the page content may be all or part of the display content of the web page.
Specifically, the selection manner of the page content may be dragging mouse selection or finger clicking selection, and the present embodiment is not limited.
Step 302, receiving a trigger signal for opening a text file through a browser;
if the user needs to store the page content in the current webpage, a trigger signal for opening the text file can be sent to the browser, so that the browser can open the text file according to the trigger signal.
In practical applications, a menu item for generating a trigger signal, such as "insert into text" or the like, may be added in advance in a menu of the browser, and if the user selects the menu item, it is determined that the trigger signal is received.
Step 303, if a pre-established text file exists, and the pre-established text file stores the page content of at least one webpage, displaying the pre-established text file through a browser, wherein the pre-established text file is displayed by the browser according to a trigger signal;
if the user needs to store the page contents in the multiple webpages, the multiple page contents can be stored in the same text file, so that the memory resources occupied by the multiple text files are saved. Further, if the multiple page contents are associated with each other, the multiple page contents are stored in the same text file, so that the user can conveniently view the multiple page contents, and the viewing efficiency of the text file is improved.
Specifically, each newly created text file may be named in advance through the browser, and displaying the text file established in advance may specifically be displaying a file name of each text file. Furthermore, the file name can be set as the content related to the page content, so that a plurality of mutually related page contents are stored in the same text file, and the viewing efficiency of the text file is improved.
Step 304, receiving a second selection signal for determining a final text file through the browser, wherein the final text file is one of the pre-established text files;
if the user needs to store the page content in a pre-established text file, one text file can be selected from the displayed text files, and the page content is stored in the selected text file; if the user needs to store the page content in the newly-built text file, a text file can be newly built through a special interface of the browser, the page content is stored in the newly-built text file, and the process is ended.
Step 305, determining a final text file through the browser, wherein the final text file is determined by the browser according to the second selection signal;
in this embodiment, the final text file may be a text file pre-established by a browser, or may be a text file newly created by a browser.
Step 306, opening the final text file through a browser;
in particular, the final text file may be opened through a dedicated API in the browser. For example, the special API may be a Filereader API in HTML5, or the like.
Step 307, the page content is stored in the text file by the browser.
Specifically, storing the page content in the text file through the browser may include:
the page content is stored in the final text file through a dedicated interface in the browser.
Preferably, the pre-selected page content may be stored in a text file opened by the browser through the dedicated interface. Wherein the proprietary interface may be the proprietary API interface in step 306.
Furthermore, the source information of the page content can be identified, so that the user can search related content according to the source, or the credibility of the page content can be determined according to the source. The source information for identifying the source of the page content may be a web page address of a web page to which the page content belongs, or may be other identification information, which is not limited in this embodiment.
If the source information is a web page address, storing the page content in a text file through a browser may include:
acquiring a webpage address of a current webpage through a browser;
storing the web page address in a text file through a browser;
and storing the page content in a position corresponding to the webpage address in the text file through the browser.
After the browser obtains the web page address, the web page address may be stored in a text file, and the page content may be stored at a location corresponding to the web page address. For example, the web page address is stored before or after the page content, and the embodiment is not limited.
For convenience of understanding, in the present embodiment, a case that a web page address is stored before a page content is taken as an example for explanation, and it is assumed that first web page information of a first web page is already stored in an open text file, where the first web page information may include a first web page address and first page content, when storing current web page information of a current web page into the text file, the current web page address of the current web page may be stored after the first web page content, and the current page content is stored after the current web page address, please refer to an application schematic diagram of web page information storage of multiple web pages shown in fig. 4. According to the method and the device, the operation that the user needs to open the text files when viewing the page contents of the webpages can be saved, and the viewing efficiency of the text files is improved.
Furthermore, in order to distinguish the webpage information of a plurality of webpages, the webpage information can be numbered; or, different fonts, font sizes, colors, background colors, and the like are set for different pieces of web page information, and the embodiment is not limited.
In summary, in the method for storing webpage information provided by the embodiment of the present invention, the browser selects the content of the page to be stored in the current webpage; receiving a trigger signal for opening a text file through the browser; opening the text file through the browser, wherein the text file is opened by the browser according to the trigger signal; the page content is stored in the text file through the browser, so that the problems that the page content is cached in a memory by the existing webpage information storage method, the memory occupation amount of a system is increased, and the memory resource of the system is wasted are solved, and the effect of saving the memory resource of the system is achieved. In addition, if a pre-established text file exists and the pre-established text file stores the page content of at least one webpage, the pre-established text file is displayed through the browser, a second selection signal used for determining a final text file is received through the browser, the final text file is one of the pre-established text files, the page contents of a plurality of webpages can be stored in the same text file, the problem of electronic equipment loss caused by the fact that the plurality of text files need to be opened when the page contents of the plurality of webpages are viewed is solved, and the effect of prolonging the service life of the electronic equipment is achieved.
It should be added that, the storage method of the web page information provided in the second embodiment may be combined with the storage method of the web page information provided in the third embodiment, that is, after the file format is determined by the browser, if a pre-established text file exists in a text file corresponding to the file format, the pre-established text file may be displayed by the browser, and a second selection signal for determining a final text file is received by the browser, where the final text file is one of the pre-established text files, the final text file is determined by the browser according to the second selection signal, the final text file is opened by the browser, and the page content is stored in the text file by the browser; or,
if the pre-established text file exists, the pre-established text file can be displayed according to a file format through the browser, a first selection signal for determining the file format is received through the browser, the file format is determined according to the first selection signal through the browser, and the text file corresponding to the file format is opened through the browser.
The specific implementation flow of the above steps is described in the second embodiment and the third embodiment, and details are not described herein.
Example four
Referring to fig. 5, a structural framework diagram of an electronic device according to a fourth embodiment of the present invention is shown, where the electronic device includes a browser, and may be a smart television, a smart phone, or a tablet computer. The electronic device includes:
a selecting module 501, configured to select, through a browser, page content to be stored in a current webpage;
a first receiving module 502, configured to receive, through a browser, a trigger signal for opening a text file;
an opening module 503, configured to open a text file through a browser, where the text file is opened by the browser according to the trigger signal received by the first receiving module 502;
a storage module 504, configured to store, by the browser, the content of the page selected by the selection module 501 in the text file opened by the opening module 503.
In summary, in the electronic device provided in the embodiment of the present invention, the browser selects the page content to be stored in the current webpage; receiving a trigger signal for opening a text file through the browser; opening the text file through the browser, wherein the text file is opened by the browser according to the trigger signal; the page content is stored in the text file through the browser, so that the problems that the page content is cached in a memory by the existing webpage information storage method, the memory occupation amount of a system is increased, and the memory resource of the system is wasted are solved, and the effect of saving the memory resource of the system is achieved.
EXAMPLE five
Referring to fig. 6, a structural framework diagram of an electronic device according to a fifth embodiment of the present invention is shown, where the electronic device includes a browser, and may be a smart television, a smart phone, or a tablet computer. The electronic device includes: a selection module 501, a first receiving module 502, an opening module 503 and a storage module 504.
A selecting module 501, configured to select, through a browser, page content to be stored in a current webpage;
a first receiving module 502, configured to receive, through a browser, a trigger signal for opening a text file;
an opening module 503, configured to open a text file through a browser, where the text file is opened by the browser according to the trigger signal received by the first receiving module 502;
a storage module 504, configured to store, by the browser, the content of the page selected by the selection module 501 in the text file opened by the opening module 503.
Further, the electronic device may further include:
a first displaying module 505, configured to, after the first receiving module 502 receives the trigger signal for opening the text file through the browser, display a file format of the text file through the browser, where the file format is displayed by the browser according to the trigger signal and is at least one;
a second receiving module 506, configured to receive, through the browser, a first selection signal for determining a file format displayed by the first displaying module 505;
accordingly, the opening module 503 may include:
a first determining unit 503A, configured to determine, by the browser, a file format, where the file format is determined by the browser according to the first selection signal;
a first opening unit 503B for newly creating and opening a text file corresponding to the file format determined by the first determining unit 503A through the browser.
Further, if a pre-established text file exists, and the pre-established text file stores the page content in at least one webpage, the apparatus may further include:
a second display module 507, configured to display, by the browser, the pre-established text file after the first receiving module 502 receives the trigger signal for opening the text file through the browser, where the pre-established text file is displayed by the browser according to the trigger signal;
a third receiving module 508, configured to receive, through the browser, a second selection signal for determining a final text file, where the final text file is one of the pre-established text files displayed by the second displaying module 507;
accordingly, the opening module 503 may include:
a second determining unit 503C, configured to determine, by the browser, a final text file, where the final text file is determined by the browser according to the second selection signal;
a second opening unit 503D for opening the final text file determined by the second determining unit 503C through the browser;
accordingly, the storage module 504 is configured to store the page content in the final text file via the browser.
Further, the storage module 504 may include:
an obtaining unit 504A, configured to obtain a web page address of a current web page through a browser;
a first storage unit 504B, configured to store the web page address acquired by the acquisition unit 504A in a text file through a browser;
and a second storage unit 504C for storing the page contents in a position corresponding to the web page address stored in the first storage unit 504B in the text file through the browser.
Further, the first storage unit 504B is specifically configured to store the web page address in the text file through a dedicated interface in the browser;
correspondingly, the second storage unit 504C is specifically configured to store the page content in the text file at a location corresponding to the web page address through a dedicated interface in the browser.
In summary, in the electronic device provided in the embodiment of the present invention, the browser selects the page content to be stored in the current webpage; receiving a trigger signal for opening a text file through the browser; opening the text file through the browser, wherein the text file is opened by the browser according to the trigger signal; the page content is stored in the text file through the browser, so that the problems that the page content is cached in a memory by the existing webpage information storage method, the memory occupation amount of a system is increased, and the memory resource of the system is wasted are solved, and the effect of saving the memory resource of the system is achieved. In addition, if a pre-established text file exists and the pre-established text file stores the page content of at least one webpage, the pre-established text file is displayed through the browser, a second selection signal used for determining a final text file is received through the browser, the final text file is one of the pre-established text files, the page contents of a plurality of webpages can be stored in the same text file, the problem of electronic equipment loss caused by the fact that the plurality of text files need to be opened when the page contents of the plurality of webpages are viewed is solved, and the effect of prolonging the service life of the electronic equipment is achieved.
It should be noted that: in the electronic device provided in the above embodiment, when storing the web page information, only the division of the above functional modules is taken as an example, 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 electronic device is divided into different functional modules to complete all or part of the above described functions. In addition, the electronic device and the embodiment of the method for storing webpage information provided by the embodiment belong to the same concept, and specific implementation processes of the method and the embodiment are detailed in the embodiment and are not described again.
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.