Embodiments of the present disclosure relate to, but not limited to, the technical field of network communication, and in particular, to method and device for processing static page data.
Development of Internet technology has made it easier for people to interact information with each other, and web pages are a necessary way to obtain Internet information. In order to further improve convenience of information interaction among users, the comment function of websites becomes especially important, most web pages are dynamic pages, and the dynamic effect is achieved by compiling the pages by the server. Further, the comment function is one of the most important functions of a majority of dynamic websites. Comment data of the front-end users is stored by a back-end server, then pages are dynamically loaded by the server, so that contents of the comment are displayed on the front-end pages. As for static pages (static web pages actually exist, they are directly loaded and displayed on the client browser, without being compiled by the server), there is no dynamic loading module for the back-end server, most static pages provide only sharing of information (e.g., sharing of knowledge etc.), every page of static websites is directly returned from the server, and dynamic data update cannot be achieved, thus the comment function cannot be achieved with respect to the static pages per se.
The technical problem addressed by the embodiments of the present disclosure is to provide a method and device for processing static page data, so as to enable users to view other people's comment information on the page and to comment on any static page.
A method for processing static page data, comprising:
Optionally, the request message for accessing the comment data of the static page includes user information and a uniform resource locator of a current page being accessed.
Optionally, when returning the comment data to the user equipment, the method further comprises:
Optionally, after returning the comment data to the user equipment, the method further comprises:
Optionally, after returning the comment data to the user equipment, the method further comprises:
A device for processing static page data, comprising:
Optionally, the request message for accessing the comment data of the static page includes user information and a uniform resource locator of a current page being accessed.
Optionally, the device further comprises:
Optionally, the processing module is further configured to, when returning the comment data to the user equipment, also return a comment submitting module.
A device for processing static page data, comprising: a memory, a processor and a computer program stored on the memory and operable on the processor, wherein the processor, when executing the program, carries out the following steps:
To sum up, the embodiments of the present disclosure provide a method and device for processing static page data, so that users can comment on any static page and view other people's comment information on the page.
To make the objectives, the technical solutions, and the advantages of the present disclosure more clear, the embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings. It needs to be noted that, in a case of having no conflict, the embodiments of the present disclosure and the features in the embodiments may be combined arbitrarily.
Step 101, a request message for accessing comment data of a static page is received from a user equipment; and
Step 102, comment data corresponding to the static page is searched for in a storage module according to the request message, and the comment data is returned to the user equipment.
Herein, the request message for accessing the comment data of the static page includes user information and a Uniform/Universal Resource Locator, URL, of a current page being accessed.
This embodiment of the present disclosure solves the problem that static pages cannot be commented and dynamically loaded by constructing a separate commenting system. A segment of code is embedded in a static page, an asynchronous request instruction is initiated while the user requests the static page. After the instruction arrives at the commenting system, the stored comment data is obtained from the local file and finally presented on the front-end page.
Meanwhile, the comment submitting module may also be presented on the front-end page, and the user can post a comment on the comment submitting module. Similarly, the comment instruction is sent to the commenting system server in an asynchronous request manner, and the commenting system processes data of the comment instruction and saves it in the local file.
This process does not require dependency related to the client and the browser module, all users browsing the static page can achieve the comment function through asynchronous loading, and the commenting system is independent of the static website.
Step 201, after receiving the static page by the user, the asynchronous request is triggered. The static page is directly fed back to the front-end user browser without being compiled by the server. The front-end user browser triggers the asynchronous request after receiving the returned static page.
Content of the asynchronous request includes current user information and URL of the current page being accessed, and the asynchronous request is sent to the commenting system server.
In this embodiment, after the user accesses the static page, the asynchronous request is triggered, and the comment module and the corresponding comment data are obtained from the comment server. During processing of the comment server, the browser continues to load other elements of the static page without being affected by the blocking.
Step 202, after receiving the asynchronous request, the commenting system server searches for the corresponding comment data according to the asynchronous request.
After the commenting system server parses the asynchronous request and obtains user information and URL of the current page being accessed, the corresponding comment data is searched for in the storage module according to the user information and the URL of the current page being accessed.
Step 203, after the commenting system server finds the comment data of the corresponding page, the comment data is processed and loaded, and finally returned to the front-end user and presented on the page.
In this way, the method of this embodiment can implement asynchronous loading of local comment data.
This embodiment differs from the second embodiment in: a comment submitting module is also returned to the user while the comment data is returned to the user equipment by the commenting system.
Step 301, when the commenting system server returns the comment data to the user, what is returned together also includes a comment submitting module, and the user can comment on the page in the comment submitting module.
Step 302, the user actively triggers a submitting instruction after commenting on the page, so as to send the comment data to the commenting system server.
Step 303, after receiving the user comment, the commenting system server performs data processing on the user comment and thereafter stores it in a local comment data file corresponding to the current page.
In respect of storage of the comment data, a database module may be established in the commenting system server for storing the user comment data.
The advantages of establishing a database module in the commenting system server are that: data is stable and secure, and is not easy to be lost, but database service needs to be built, and resource consumption is large.
This embodiment of the present disclosure solves the problem that static pages cannot be commented and dynamically loaded, by constructing a separate commenting system which comprises the device 400 for processing static page data according to the present embodiment. In this embodiment, a segment of code is embedded in a static page, an asynchronous request instruction is initiated while the user requests the static page. After the instruction arrives at the commenting system server, the stored comment data is obtained from the local file and finally presented on the front-end page.
Herein, the request message for accessing the comment data of the static page includes user information and a URL of a current page being accessed.
In this way, the device of this embodiment can implement asynchronous loading of local comment data.
This embodiment differs from the fourth embodiment in: as shown in
The processing module 403 may be further configured to when returning the comment data to the user equipment, also return a comment submitting module 404.
The device of this embodiment can realize comment submission on the static page.
This embodiment further provides a device for processing static page data, comprising: a memory, a processor and a computer program stored on the memory and operable on the processor, wherein the processor, when executing the program, carries out the following steps:
The technical solution of this embodiment of the present disclosure enables users to comment on any static page and to view other people's comment information on the page.
An embodiment of the present disclosure also provides a computer-readable storage medium storing computer-executable instructions that, when executed, implement the method for processing static page data.
As will be appreciated by those of ordinary skill in the art, all or parts of the steps in the above embodiments may be implemented by a program that instructs relevant hardware, the program may be stored in a computer-readable storage medium, such as a read-only memory, a magnetic disc, an optical disk, or the like. Optionally, all or parts of the steps of the above embodiments may also be implemented using one or more integrated circuits. Correspondingly, each module/unit in the foregoing embodiments may be implemented in form of hardware, or may be implemented in form of a software functional module. The present disclosure is not limited to any specific form of combination of hardware and software.
The foregoing are only preferred embodiments of the present disclosure, the present disclosure may of course have various other embodiments. Various corresponding changes and modifications may be made by those skilled in the art without departing from the spirit and scope of the present disclosure, but these corresponding changes and modifications should be within the protection scope of the appended claims of the present disclosure.
The present application claims the benefit of priority of Chinese patent application with the application No. of 201710587072.4, filed on Jul. 18, 2017, which is incorporated by reference herein in its entirety as a portion of the present application.
| Number | Date | Country | Kind |
|---|---|---|---|
| 201710587072.4 | Jul 2017 | CN | national |
| Filing Document | Filing Date | Country | Kind |
|---|---|---|---|
| PCT/CN2018/077407 | 2/27/2018 | WO | 00 |