Web page processing method, device, computer equipment and storage medium
The operation and status update of the page stack is implemented in the browser through the history status management middleware, which solves the problem of low applicability of traditional browser native functions in page history management and improves the access and management capabilities of the page stack. , achieving more efficient page jumps and status updates.
Patent Information
- Application Number
- CN202010974546.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-16
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2040-09-16
Smart Images

Figure CN112214697B
Abstract
Description
Technical Field
[0001] The present application relates to computer technology and Internet technology, and in particular to a web page processing method, apparatus, computer equipment and storage medium. Background Art
[0002] With the continuous development of Internet technology, a lot of information or content is published on the Internet, and users access web pages by using browsers. In order to facilitate access to web pages, the history of web pages is generally managed. The traditional method is to use the native functions of the browser to manage the history of the page.
[0003] However, in this traditional method, the application layer mostly calls the browser's native application programming interface to achieve simple and unified page management and control such as page forward and page backward. However, the browser does not provide a specific access interface for the page stack, thus limiting the application layer's access to the historical records in the page stack, and the applicability is low. Summary of the invention
[0004] Based on this, it is necessary to provide a web page processing method, device, computer equipment and storage medium that can improve applicability in response to the above technical problems.
[0005] A web page processing method, applied to history record status management middleware, the method comprising:
[0006] Receive a processing request sent by the application layer for a specified web page;
[0007] When the processing request is a page operation request,
[0008] In the page stack set in the historical record state management middleware, searching whether the specified web page exists; the page stack elements in the page stack are the recorded historical web pages; different page stack elements are different historical web pages;
[0009] When the designated web page is found, the first native interface of the browser is called to control the pointer of the page stack to move up or down from the current web page in the page stack until it points to the designated web page, so as to jump to the designated web page.
[0010] In one embodiment, before searching whether the specified web page exists in the page stack set in the history record state management middleware, the method further includes:
[0011] Check whether the singleton page stack element mode is enabled;
[0012] When the singleton page stack element mode is enabled, searching whether the specified web page exists in the page stack set in the history record state management middleware is executed;
[0013] When the singleton page stack element mode is not enabled, calling the second native interface of the browser to push the specified web page into the stack as a page stack element;
[0014] The pointer of the page stack is updated to point to the newly stacked page stack element, so as to jump to the designated web page.
[0015] In one embodiment, the method further comprises:
[0016] When the specified web page is not found,
[0017] Calling a second native interface of the browser to add the specified web page as a page stack element to the page stack;
[0018] The pointer of the page stack is updated to point to the added page stack element, so as to jump to the designated web page.
[0019] In one embodiment, calling the second native interface of the browser to add the specified web page as a page stack element to the page stack includes:
[0020] When the current webpage is the top element of the stack, calling the second native interface of the browser to add the specified webpage above the current webpage in the page stack;
[0021] When the current webpage is not a stack top element, the page stack elements above the current webpage in the page stack are cleared, and the second native interface of the browser is called to push the designated webpage into the stack as a stack top element.
[0022] In one embodiment, the page operation request includes a page status update request; the method further includes:
[0023] caching the page status information to be updated of the specified web page carried in the page status update request;
[0024] After jumping to the designated web page, the designated web page is updated according to the cached page status information to be updated.
[0025] In one embodiment, the method further comprises:
[0026] Detecting whether the specified web page is the current web page;
[0027] When the designated web page is not the current web page and the processing request is a page status update request, searching in the page stack set in the history record status management middleware whether the designated web page exists;
[0028] When the designated web page is the current web page, the current web page is updated according to the page status information to be updated carried in the page status update request.
[0029] In one embodiment, the history record status management middleware records the page status information of each historical web page;
[0030] The method further comprises:
[0031] When the processing request is a page status acquisition request,
[0032] The page status information corresponding to the designated web page is searched from the recorded page status information of each historical web page.
[0033] In one embodiment, the method further comprises:
[0034] When it is detected that the web application is entered for the first time, an event declaring proxy page operation history management is triggered; the proxy event includes the proxy processing the processing request for the designated page;
[0035] Synchronizing the historical web page records of the browser, and initializing a page stack for recording historical web pages and storing page status information of each historical page according to the historical web page records, to obtain an initialized historical record status management middleware;
[0036] The page stack and the page status information in the history record status management middleware are updated according to the designated page targeted by each proxy processing request and the processing result of the processing request.
[0037] A web page processing device, arranged in a history record status management middleware, comprising:
[0038] The acquisition module is used to receive the processing request sent by the application layer for the specified web page;
[0039] A search module, for searching, when the processing request is a page operation request, whether the specified web page exists in the page stack set in the history record state management middleware; the page stack elements in the page stack are the recorded history web pages; different page stack elements are different history web pages;
[0040] The jump module is used to call the first native interface of the browser when the specified web page is found, control the pointer of the page stack, move up or down from the current web page in the page stack until it points to the specified web page, so as to jump to the specified web page.
[0041] A computer device includes a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps in the web page processing method described in each embodiment of the present application.
[0042] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the web page processing method described in each embodiment of the present application.
[0043] In the above web page processing method, device, computer equipment and storage medium, the application layer sends a processing request for a specified page to the history record status management middleware. When it is a page operation request, it can search in the page stack of the middleware to see whether the specified web page exists. If it exists, the native interface of the browser is called to control the pointer to move up or down until it points to the specified web page, so as to jump to the specified web page. By proxy processing the request through the history record status management middleware, the application layer can access and process the page stack information, improve the applicability and operability of the historical pages in the page stack, and avoid limitations. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A diagram of an application environment of a web page processing method in one embodiment;
[0045] Figure 2 A schematic diagram of a flow chart of a web page processing method in one embodiment;
[0046] Figure 3 A schematic diagram of a conventional page jump in an embodiment;
[0047] Figure 4 A schematic diagram of page jump in a web page processing method in one embodiment;
[0048] Figure 5 A schematic diagram of a calling logic of a traditional call to a browser native interface in one embodiment;
[0049] Figure 6 A schematic diagram of an interface call logic in a web page processing method in one embodiment;
[0050] Figure 7 A schematic diagram of initializing a history record status management middleware in one embodiment;
[0051] Figure 8 is a flow chart of a web page processing method in another embodiment;
[0052] Fig. 9 is a block diagram of a web page processing device in one embodiment;
[0053] Fig.10 is a block diagram of a web page processing device in one embodiment;
[0054] Fig.11 FIG. 1 is a block diagram of a computer device in one embodiment. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0056] The web page processing method provided in this application can be applied to Figure 1 In the application environment shown. The history record state management middleware 102 communicates with the application layer 104 and the browser 106 respectively. Among them, the history record management state middleware 102 records all the current history records of the browser to form a page stack, stores page state information, and proxies page operation management events. Therefore, the processing request sent by the application layer 104 to the browser 106 will be proxied by the history record state management middleware 102, that is, the application layer 104 can send a processing request for a specified web page by calling the interface of the history record state management middleware 102. After the history record state management middleware 102 processes it internally, it will call the browser's native interface for further processing if necessary.
[0057] It can be understood that some processing requests can be directly processed by the history record status management middleware 102. For example, since the history record status middleware records the page stack and page status information of all the current history records of the browser, the processing request for page status query can be directly queried from the page status information recorded by the history record status management middleware 102 without calling the browser's native interface.
[0058] Specifically, when a user operates a specified page based on a web application, the application layer 104 can call the corresponding interface of the history record state management middleware and send a processing request for the specified web page to the history record state management middleware. When the processing request is a page operation request, the history record state management middleware 102 can search for a record of the specified web page in the page stack set in the history record state management middleware. The page stack elements in the page stack are the recorded historical web pages; different page stack elements are different historical web pages. When the specified web page is found, the history record state management middleware 102 can call the first native interface of the browser 106 to control the pointer of the page stack, and move up or down from the current web page in the page stack until it points to the specified web page, so as to jump to the specified web page.
[0059] In one embodiment, Figure 2 As shown, a web page processing method is provided, which is applied to Figure 1 The historical record state management middleware 102 in the example is used as an example to illustrate, including the following steps:
[0060] Step 202: Receive a processing request sent by the application layer for a specified web page.
[0061] Among them, the Route State Management (RSM) middleware is a middleware developed specifically for web applications and is located between the application layer and the browser's native interface. It is used to manage historical web page records and page status information. The Route State Management middleware is set up to centrally store and record all the current historical pages of the browser, store the page status information of each historical page, and proxy page operation management events.
[0062] It should be noted that the interface of the history record state management middleware can be called by the application layer, and the history record state management middleware can call the native interface of the browser. Therefore, through the proxy of the history record state management middleware, the application layer can indirectly call the browser's native interface regarding the history record, thereby solving the problem that the application layer cannot read or operate the history record.
[0063] In one embodiment, the page status information includes at least one type of status information such as a query, a parameter, a meta information, and a sequence between web pages.
[0064] The proxy page operation management event means that the processing request initiated by the application layer will be proxy processed by the history record status management middleware. It can be understood that since the history record status management middleware proxies the page operation management event, it can determine the page and page status information targeted by the page operation management event proxied by it. Therefore, the history record status management middleware can update the page and page status information targeted by the proxy page operation management event to the page stack and page status information recorded and stored by it. It can be understood that when the proxy page operation management event has an update of the page status information, it will be updated to the page status information stored by the history record status management middleware. When there is no update of the page status information, no status update is performed.
[0065] In one embodiment, the proxy page operation management event may include at least one of a proxy page jump, update, redirection method, and a method for obtaining page status information.
[0066] The application layer is the application layer of the web application. The designated web page is the target web page, which refers to the web page that needs to be processed. The processing request is used to request the processing of the designated web page.
[0067] Specifically, the user can perform processing operations on a specified web page based on a single-page web application, and the application layer can generate a processing request for the specified web page, and call the interface of the historical record status management middleware to send the processing request to the historical record status management middleware.
[0068] Among them, a single-page web application (SPA for short) is a special web application. It limits all activities to a web page and only loads the corresponding HTML, JavaScript and CSS when the web page is initialized. Once the page is loaded, SPA will not reload or jump the page due to user operations. Instead, it uses JavaScript to dynamically change the HTML content to achieve interaction between the UI and the user.
[0069] In one embodiment, the designated web page may be a current web page or a non-current web page. The current web page refers to a web page currently loaded and displayed.
[0070] In one embodiment, the processing request may include a page operation request and a page information query request. The page operation request may include at least one of page jump, page update, page deletion and page addition. The page information query request may include a page status query request.
[0071] It can be understood that different types of processing requests can call different interfaces in the history state management middleware. For example, when the page operation request is a page state update request, the RSM replaceRouter interface can be called. When the processing request is a page state query request, the RSM getRoutestate interface can be called.
[0072] Step 204: when the processing request is a page operation request, a search is performed in the page stack set in the history record state management middleware to determine whether a specified web page exists.
[0073] The page operation request is a request that requires a specific operation to be performed on the specified page itself. It can be understood that the page operation request is different from the page information query type request because the page information query type request does not require processing of the page itself.
[0074] It can be understood that a page stack for recording all historical web pages currently visited by the browser is set in the history record state management middleware. Historical web pages are web pages that have been visited historically. The page stack elements in the page stack are the recorded historical web pages. Different page stack elements are different historical web pages. That is, the same web page only has one page stack element in the page stack, and the same web page will not be recorded repeatedly in the page stack.
[0075] Specifically, when the processing request is a page operation request, the history record state management middleware can search whether the specified web page exists in the page stack according to the page path, that is, search whether the specified web page exists in the page stack elements recorded in the page stack.
[0076] It should be noted that in order to respond to a page operation request for a specified web page, it is necessary to jump to the specified web page for corresponding processing. Therefore, regardless of whether the page operation request is a page jump request or a page status update request, steps 204 to 206 will be executed. The difference is that when the page operation request is a page jump request, it can jump to the specified web page, and when the page operation request is a page status update request, after jumping to the specified web page, it is necessary to further process the specified web page.
[0077] Step 206, when the designated web page is found, the first native interface of the browser is called to control the pointer of the page stack to move up or down from the current web page in the page stack until it points to the designated web page, so as to jump to the designated web page.
[0078] Among them, the first native interface of the browser is the browser's native interface for moving forward and backward through historical pages.
[0079] In one embodiment, the first native interface may be a history.go interface native to the browser.
[0080] Specifically, the pointer of the page stack currently points to the current web page. When a specified web page is found, the history record state management middleware can call the first native interface of the browser to control the pointer of the page stack, and move up or down in the page stack from the current web page in the page stack until it points to the specified web page, so as to jump to the specified web page. It can be understood that if the pointer of the page stack points to the specified web page, then the specified web page can be jumped to.
[0081] In the above web page processing method, the application layer sends a processing request for a specified page to the history record status management middleware. When it is a page operation request, it can search in the page stack of the middleware to see whether the specified web page exists. If it exists, the browser's native interface is called to control the pointer to move up or down until it points to the specified web page, so as to jump to the specified web page. By having the history record status management middleware proxy process the request, the application layer can access and process the page stack information, improve the applicability and operability of the historical pages in the page stack, and avoid limitations.
[0082] In addition, when a specified web page exists in the page stack, there is no need to add additional stack element records. Instead, the pointer is controlled to move up or down to jump to the specified web page, which saves system resources, avoids redundancy, and improves jump efficiency.
[0083] In one embodiment, before searching whether the specified web page exists in the page stack set in the history state management middleware, the method further includes: detecting whether the singleton page stack element mode is enabled; when the singleton page stack element mode is enabled, performing step 204 of searching whether the specified web page exists in the page stack set in the history state management middleware and step 206. When the singleton page stack element mode is not enabled, calling the second native interface of the browser, pushing the specified web page as a page stack element; updating the pointer of the page stack to point to the newly pushed page stack element, so as to jump to the specified web page.
[0084] The singleton page stack element mode refers to a mode in which each web page can have at most one stack element in the page stack. The second native interface refers to a browser native interface for stacking web pages.
[0085] In one embodiment, the second native interface may be a history.pushState interface native to the browser.
[0086] Specifically, in the embodiment of the present application, the singleton page stack element mode may not be set by default, and the singleton page stack element mode may be enabled or not. After receiving the page operation request, the history record state management middleware may detect whether the singleton page stack element mode is enabled.
[0087] It can be understood that when the singleton page stack element mode is enabled, it means that the same web page can only correspond to one page stack element in the page stack, that is, the same web page will not be recorded repeatedly in the page stack. Then, steps 204 and 206 can be executed. If the specified web page is found in the page stack, it means that the specified web page already belongs to the historical web page recorded in the page stack, and it does not need to be pushed into the stack again. Instead, the first native interface of the browser can be directly called to control the pointer of the page stack to move up or down to jump to the specified web page. In this way, the waste of system resources caused by unnecessary push processing can be saved.
[0088] When the singleton page stack element mode is not enabled, it means that the page stack is not limited to repeatedly recording the same web page, that is, the same web page can be pushed into the stack multiple times. Then, the history record state management middleware can call the second native interface of the browser, push the specified web page into the stack as a page stack element, and update the pointer of the page stack to point to the newly pushed page stack element to jump to the specified web page. Compared with the traditional method in which the application layer cannot access the page stack, when the singleton page stack element mode is not enabled, the history record state management middleware is used as a proxy to push the specified web page into the stack as a page stack element, which can avoid restrictions and improve the operability of the data in the page stack.
[0089] In one embodiment, the method further includes: when the specified web page is not found, calling the second native interface of the browser, adding the specified web page as a page stack element to the page stack; updating the pointer of the page stack to point to the added page stack element to jump to the specified web page.
[0090] It can be understood that when the specified web page is not found, it means that the specified web page has not been recorded in the page stack. The history record status management middleware can call the second native interface of the browser to push the specified web page into the stack, so as to add the specified web page as a page stack element to the page stack, and update the pointer of the page stack to point to the added page stack element, that is, update the pointer of the page stack to point to the added specified web page, so as to jump to the specified web page.
[0091] In one embodiment, different push processing can be performed on the designated page according to the different positions of the current web page in the page stack. It can be understood that page jump refers to jumping from the current web page to the designated web page. After the designated web page is pushed into the page stack, it will be adjacent to the current web page and above the current web page in the page stack, and the current web page can be the top element or non-top element in the page stack. In these two different situations, the designated web page can be pushed into the page differently.
[0092] In the above embodiment, when the specified web page is not found, the middleware calls the second native interface of the browser and adds the specified web page as a page stack element to the page stack; the pointer of the page stack is updated to point to the added page stack element to jump to the specified web page. Compared with the problem that the application layer cannot access the page stack in the traditional method, the applicability and operability of the historical web pages recorded in the page stack are improved.
[0093] In one embodiment, calling the second native interface of the browser to add the specified web page as a page stack element to the page stack includes: when the current web page is the top element of the stack, calling the second native interface of the browser to add the specified web page above the current web page in the page stack.
[0094] The top element refers to the page stack element at the top of the page stack, and the non-top element refers to the page stack element at a position other than the top of the page stack.
[0095] Specifically, when the current web page is the top element of the stack, the history record state management middleware can call the second native interface of the browser to add the specified web page above the current web page in the page stack to implement the stacking process of the specified web page. In this way, the specified web page is the top element of the stack, and the pointer of the page stack advances from the current page to point to the specified web page.
[0096] In one embodiment, when the current web page is not a stack top element, the page stack elements above the current web page in the page stack are cleared, and the second native interface of the browser is called to push the specified web page into the stack as the stack top element.
[0097] It can be understood that when the current web page is not the top element of the stack, it means that there are other page stack elements above the current web page in the page stack. When the history record state management middleware pushes the specified web page into the stack, it can clear the page stack elements above the current web page in the page stack and call the second native interface of the browser to push the specified web page into the stack as the top element. The pointer of the page stack then moves from the current page to point to the specified web page.
[0098] For ease of understanding, now combined Figure 3 and Figure 4 Give an example. Figure 3 A schematic diagram of a traditional method for page jump. Figure 4 Schematic diagram of page jump in the embodiment of the present application. The solid arrow indicates that the page jump is executed by clicking the link (pushState), and the dotted arrow indicates that the page back operation is executed. The web page with dark background is pointed to by the current pointer in the page stack. Each item is a page stack element in the page stack. For example, A.html and B.html represent web page A and web page B respectively, which are page stack elements. History stack element.
[0099] Reference Figure 3 302 and Figure 4 As can be seen from 402, if the current page is the top element of the stack, and each specified page to be jumped to is a new page that does not exist in the page stack, the specified web page can be added to the page stack as a page stack element; the pointer of the page stack is updated to point to the added page stack element to jump to the specified web page.
[0100] For example, in 302 and 402, initially on page A, the operation "click the link" is executed ( Figure 3 Processing in) or pushRouter( Figure 4 After the processing in ), the number of history stacks increases, and the current pointer moves up one position to B.html, jumping to page B. Similarly, if the "click link" or pushRouter operation is performed twice more, the history stack increases by 2, and the current pointer is still at the top of the stack, pointing to D.html, that is, jumping to page D.
[0101] from Figure 3 304 and Figure 4 From the 404 in the example, if the user performs a browser back operation, then Figure 3 and Figure 4 In both cases, the number of history stacks can be kept unchanged and the back-up process can be performed. For example, in 304 and 404, the current pointer moves down one position to C.html, that is, backs up to the C page.
[0102] from Figure 3 As shown in 306, in the traditional page jump method, when the user requests to jump to the web page that has been visited again by operating "clicking the link", the top element of the stack will be modified to the web page requested to be visited again, the current pointer will be moved to the top of the stack, and the number of historical stacks will remain unchanged. For example, in 306, after returning from web page D to web page C, if a request is made to jump from web page C to web page B, the top element of the stack will be modified from D.html to B.html, that is, the top element of the stack will be modified from web page D to web page B.
[0103] However, from Figure 4It can be seen from 406 that in the page jump method in the embodiment of the present application, when the user executes the pushRouter operation again to request to jump to the specified web page that has been visited, that is, when the specified web page requested to jump exists in the page stack, the top element of the stack will remain unchanged, but the current pointer will be controlled to move up or down to point to the specified web page, and the number of historical stacks will remain unchanged, that is, there is no need to add a new stack record and no need to modify the top element of the stack. For example, in 406, after returning from web page D to web page C, if a request is made to jump from web page C to web page B, there is no need to push web page B into the stack again, but the current pointer is controlled to move down one position to B.html, that is, there is no need to perform additional stacking and stack element modification processing, and page jump is achieved in a "retreat to advance" manner.
[0104] from Figure 3 As can be seen from 308, when the specified page to be jumped to is a new page that does not exist in the page stack, and there is more than one current page in the page stack (that is, the current page is recorded repeatedly in the page stack), the traditional page jump method requires the user to perform the browser back or forward operation, and the pointer moves down or up until it points to the most initial page of the current page in the multiple pages in the page stack. Then, the user performs the operation "click on the link" to modify the top element of the stack to the specified page, and the pointer moves to the top of the stack. For example, in 308, when the user wants to jump from web page B to web page E, since web page B is recorded twice in the page stack, the user needs to manually perform two back operations to return to the most initially visited web page B, and then click the link to jump from web page B to web page E.
[0105] from Figure 4 As can be seen from 408 in the above, when the specified page to be jumped to is a new page that does not exist in the page stack, and the current page is not the top element of the stack, the method in the embodiment of the present application is that after the user operates pushRouter, the middleware clears the web page stack elements above the current web page in the web page stack, and then pushes the specified web page into the stack as the top element of the stack. For example, in 408, when the user wants to jump from web page B to web page E, the stack elements on web page B are cleared, and web page E is pushed into the stack as the top element of the stack, that is, the top element of the stack becomes E.html, the pointer moves up to the top of the stack, and the number of historical stacks becomes 3.
[0106] In the above embodiment, when the current web page is not the top element of the stack, the page stack elements above the current web page in the page stack are cleared, and the second native interface of the browser is called to push the specified web page into the stack as the top element of the stack. The user does not need to perform too many browser back operations to jump to the specified web page, which improves the jump efficiency and operability. In addition, it can also avoid the waste of system resources caused by unnecessary back operations.
[0107] In one embodiment, the page operation request includes a page status update request. The method further includes: caching the page status information to be updated of the specified web page carried in the page status update request; after jumping to the specified web page, performing status update processing on the specified web page according to the cached page status information to be updated.
[0108] The page status update request is used to request to update the page status.
[0109] Specifically, when the page operation request is a page status update request, the page status update request will carry the page status information to be updated of the specified web page. The history record status management middleware can temporarily store (i.e., cache) the page status information to be updated of the specified web page, and perform step 204 to search whether the specified web page exists in the page stack set in the history record status management middleware, and step 206 to jump to the specified web page. After jumping to the specified web page, the history record status management middleware can perform status update processing on the specified web page according to the cached page status information to be updated.
[0110] In the above embodiment, after jumping to the specified web page, the status of the specified web page is updated according to the cached page status information to be updated. Compared with the limitation that the application layer cannot process the page status in the traditional method, the limitation is avoided and the operability of the page status is improved.
[0111] In one embodiment, the method further includes: detecting whether the specified web page is the current web page; when the specified web page is not the current web page and the processing request is a page status update request, executing in a page stack set in the history record status management middleware, searching whether the specified web page exists; when the specified web page is the current web page, performing status update processing on the current web page according to the page status information to be updated carried in the page status update request.
[0112] It can be understood that when the designated web page is the current web page, there is no need to perform a page jump. Therefore, after receiving the page status update request sent by the application layer for the designated web page, the history record status management middleware can detect whether the designated web page is the current web page. When it is not the current web page, the step of searching for the designated web page in the page stack set in the history record status management middleware in step 204 and step 206 are executed. When the designated web page is the current web page, the status of the current web page can be directly updated according to the page status information to be updated carried in the page status update request, without the need for page jump.
[0113] In the above embodiment, when the designated web page is the current web page, the status of the current web page is updated according to the page status information to be updated carried in the page status update request. Compared with the traditional method in which the application layer cannot process the page status, this avoids limitations and improves the operability of the page status.
[0114] In one embodiment, the history record status management middleware records the page status information of each historical web page. The method further includes: when the processing request is a page status acquisition request, searching for the page status information corresponding to the specified web page from the recorded page status information of each historical web page.
[0115] Specifically, since the page status information of each historical web page is recorded in the history record status management middleware, when the application layer sends a page status acquisition request for a specified web page, the page status information corresponding to the specified web page can be directly found from the recorded page status information of each historical web page.
[0116] For ease of understanding, now combined Figure 5 and Figure 6 Give an example. Figure 5 This is a call logic diagram for calling the browser native interface in the traditional method. Figure 6 This is a logic diagram of the interface call in the embodiment of the present application.
[0117] Reference Figure 5 , page jump, update and obtain page status information are all obtained by the application layer directly calling the browser's native interface (for example, history.pushState, history.replaceState and history.state interfaces). It can be understood that in this case, either the browser does not provide a native interface for it to call, or it can only obtain the page status information of the current web page.
[0118] Reference Figure 6, page jump, update, and obtain page status information processing are all proxy processing by the application layer calling the corresponding interface of RSM middleware (i.e., historical record status management middleware) (for example, RSM pushRouter interface, RSM replaceRouter interface, RSM getRouteState interface, etc.). For page operation processing such as page jump and update, after processing inside the RSM middleware, the browser's native API (native interface) is called for further processing. For the processing of obtaining page status information, the RSM getRouteState interface can be directly called to obtain the page status information of the specified web page from the RSM middleware, rather than being limited to obtaining the page status information of the current web page. Moreover, there is no need to call the browser's native interface, which improves efficiency and saves system call resources.
[0119] In the above embodiment, there is no need to call the native interface of the browser to obtain data, which improves the efficiency of obtaining page status information. Moreover, compared with calling the native interface of the browser to only obtain the page status information of the current web page, the page status information of any specified web page can be obtained from the history record status management middleware, rather than being limited to obtaining the page status information of the current web page, avoiding limitations and improving the readability of page information.
[0120] In one embodiment, the method further includes: when it is detected that a web application is entered for the first time, an event declaring proxy page operation history management is triggered; the proxy event includes the proxy processing a processing request for a specified page; synchronizing the browser's historical web page records, and initializing a page stack for recording historical web pages and storing page status information of each historical page according to the historical web page records, to obtain an initialized historical record status management middleware; and updating the page stack and page status information in the historical record status management middleware according to the specified page targeted by each proxy processing request and the processing result of the processing request.
[0121] Specifically, when it is detected that the web application is entered for the first time, the event of declaring the history state management middleware proxy page operation history management is triggered; the proxy event includes the proxy processing of the processing request for the specified page. The history state management middleware can synchronize the browser's historical web page records, and initialize the page stack for recording historical web pages and storing the page state information of each historical page according to the historical web page records, and obtain the initialized history state management middleware.
[0122] Figure 7 A schematic diagram of initializing the history record status management middleware in one embodiment. Figure 7It can be seen that when instantiating the RSM middleware (i.e., instantiating the historical record status management middleware), the RSM middleware agent can be declared to operate the history management event, synchronize the historical page records of the native browser, initialize the page stack for recording historical pages, and store the page status information of each historical page. In addition, the initialization process can also include processing such as marking the landing page, thereby completing the instantiation of the RSM middleware.
[0123] Subsequently, since the history record status management middleware will proxy events based on page operation history management, each processing request will be proxied through the history record status management middleware. The history record status management middleware will determine the historical web page records and / or new page status information generated by the new visit based on the designated page targeted by each proxy processing request and the processing result of the processing request, and then update the page stack and page status information in the history record status management middleware.
[0124] It can be understood that by synchronizing the browser's historical web page records and updating them through the events of the proxy page operation history management, the historical record state management middleware can accurately summarize and store the page state information of the historical pages and the historical web page records stored in the page stack. Therefore, when the historical record state management middleware processes the processing request sent by the application layer, it can process it more accurately and conveniently.
[0125] In addition, the history record status management middleware will change the entire page stack and status from a black box state to a transparent state, which will help the application layer better understand the page stack of the entire web page history and its corresponding status, and increase the readability and operability of the page stack and page status.
[0126] like Figure 8 As shown, in one embodiment, a web page processing method is provided, which is applied to history record state management middleware, and the method specifically includes the following steps:
[0127] Step 802: Receive a processing request sent by the application layer for a specified web page.
[0128] In one embodiment, before step 802, the method further includes: when detecting the first entry into a web application, triggering an event for declaring proxy page operation history management; the proxy event includes proxy processing of a request for processing a specified page; synchronizing the browser's historical web page records, and initializing a page stack for recording historical web pages and storing page status information of each historical page based on the historical web page records, to obtain an initialized history record status management middleware.
[0129] It can be understood that, subsequently, the history record status management middleware can update the page stack and page status information in the history record status management middleware according to the designated page targeted by each proxy processing request and the processing result of the processing request.
[0130] Step 804, detect whether the specified web page is the current web page. If yes, execute step 806, if not, execute step 824.
[0131] Step 806, detecting whether the singleton page stack element mode is enabled.
[0132] If the singleton page stack element mode is enabled and the processing request is a page jump request, execute step 808. If the singleton page stack element mode is enabled and the processing request is a page status update request, execute step 814. If the singleton page stack element mode is enabled and the processing request is a page status acquisition request, execute step 822. If the singleton page stack element mode is not enabled, execute step 812.
[0133] Step 808, searching the page stack to see whether the specified web page exists. If the specified web page is found, step 810 is executed, and if the specified web page is not found, step 812 is executed.
[0134] Among them, the page stack is set in the history record state management middleware.
[0135] Step 810, calling the first native interface of the browser, controlling the pointer of the page stack, moving up or down from the current web page in the page stack until it points to the specified web page, so as to jump to the specified web page.
[0136] Step 812, calling the second native interface of the browser, pushing the specified web page into the stack as a page stack element; updating the pointer of the page stack to point to the newly pushed page stack element, so as to jump to the specified web page.
[0137] Step 814, searching in the page stack whether the specified web page exists.
[0138] It can be understood that when the designated web page is found, step 816 is executed, and when the designated web page is not found, the process ends.
[0139] Step 816: Cache the page status information to be updated of the specified web page carried in the page status update request.
[0140] Step 818, control the pointer of the page stack to move up or down from the current web page in the page stack until it points to the specified web page, so as to jump to the specified web page.
[0141] Step 820: Update the status of the designated web page according to the cached page status information to be updated.
[0142] Step 822, searching for the page status information corresponding to the designated web page from the recorded page status information of each historical web page.
[0143] Step 824: Update the status of the current web page according to the page status information to be updated carried in the page status update request.
[0144] It should be understood that, although each step in each flow chart of the present application is shown in sequence according to the indication of the arrow, these steps are not necessarily performed in sequence according to the order indicated by the arrow. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be performed in other orders. Moreover, at least a portion of the steps in each flow chart of the present application may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.
[0145] like Fig. 9 As shown, in one embodiment, a web page processing device is provided, which is arranged in a history record state management middleware, and the device includes:
[0146] The acquisition module 902 is used to receive a processing request sent by the application layer for a specified web page.
[0147] The search module 904 is used to search whether a specified web page exists in the page stack set in the historical record status management middleware when the processing request is a page operation request; the page stack elements in the page stack are the recorded historical web pages; different page stack elements are different historical web pages.
[0148] The jump module 906 is used to call the first native interface of the browser when a specified web page is found, control the pointer of the page stack, and move up or down from the current web page in the page stack until it points to the specified web page, so as to jump to the specified web page.
[0149] In one embodiment, the apparatus further comprises:
[0150] The detection module 903 is used to detect whether the singleton page stack element mode is enabled; when the singleton page stack element mode is enabled, the search module 904 is notified to execute a search in the page stack set in the history record state management middleware to determine whether a specified web page exists.
[0151] The jump module 906 is also used to call the second native interface of the browser to push the specified web page as a page stack element when the singleton page stack element mode is not enabled; update the pointer of the page stack to point to the newly pushed page stack element to jump to the specified web page.
[0152] In one embodiment, the jump module 906 is also used to call the second native interface of the browser when the specified web page is not found, add the specified web page as a page stack element to the page stack; update the pointer of the page stack to point to the added page stack element to jump to the specified web page.
[0153] In one embodiment, the jump module 906 is also used to call the second native interface of the browser when the current web page is the top element of the stack, and add the specified web page above the current web page in the page stack; when the current web page is not the top element of the stack, clear the page stack elements above the current web page in the page stack, and call the second native interface of the browser to push the specified web page into the stack as the top element of the stack.
[0154] In one embodiment, the page operation request includes a page status update request. The apparatus further includes:
[0155] The cache module 905 is used to cache the page status information to be updated of the specified web page carried in the page status update request.
[0156] The updating module 908 is used to perform status update processing on the designated web page according to the cached page status information to be updated after jumping to the designated web page.
[0157] In one embodiment, the detection module 903 is also used to detect whether the specified web page is the current web page; when the specified web page is not the current web page and the processing request is a page status update request, the search module 904 is notified to execute in the page stack set in the history status management middleware to search whether the specified web page exists.
[0158] The updating module 908 is further configured to perform a status update process on the current web page according to the page status information to be updated carried in the page status update request when the designated web page is the current web page.
[0159] In one embodiment, the history record status management middleware records the page status information of each historical web page.
[0160] The search module 904 is also used to search for page status information corresponding to a specified web page from the recorded page status information of each historical web page when the processing request is a page status acquisition request.
[0161] like Fig.10As shown, in one embodiment, the device further includes: an initialization module 901, a detection module 903, a cache module 905 and an update module 908; wherein:
[0162] Initialization module 901 is used to trigger an event declaring proxy page operation history management when it detects the first entry into a web application; the proxy event includes the proxy processing a request for a specified page; synchronizing the browser's historical web page records, and initializing a page stack for recording historical web pages and storing page status information of each historical page based on the historical web page records, to obtain an initialized historical record status management middleware.
[0163] The updating module 908 is also used to update the page stack and page status information in the history record status management middleware according to the designated page targeted by each proxy processing request and the processing result of the processing request.
[0164] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.11 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a web page processing method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0165] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0166] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0167] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0168] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0169] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0170] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A web page processing method, characterized in that: Applied to history record status management middleware, the method includes: Receive a processing request sent by the application layer for a specified web page; When the processing request is a page operation request, detecting whether the singleton page stack element mode is enabled; When the singleton page stack element mode is enabled, searching whether the specified web page exists in the page stack set in the history record state management middleware is executed; When the singleton page stack element mode is not enabled, calling the second native interface of the browser to push the specified web page into the stack as a page stack element; Update the pointer of the page stack to point to the newly stacked page stack element, so as to jump to the designated web page; In the page stack set in the historical record state management middleware, searching whether the specified web page exists; the page stack elements in the page stack are the recorded historical web pages; different page stack elements are different historical web pages; When the designated web page is found, the first native interface of the browser is called to control the pointer of the page stack to move up or down from the current web page in the page stack until it points to the designated web page, so as to jump to the designated web page.
2. The method according to claim 1, characterized in that: The method further comprises: When the specified web page is not found, Calling a second native interface of the browser to add the specified web page as a page stack element to the page stack; The pointer of the page stack is updated to point to the added page stack element, so as to jump to the designated web page.
3. The method according to claim 2, characterized in that The calling the second native interface of the browser to add the specified web page as a page stack element to the page stack includes: When the current webpage is the top element of the stack, calling the second native interface of the browser to add the specified webpage above the current webpage in the page stack; When the current webpage is not a stack top element, the page stack elements above the current webpage in the page stack are cleared, and the second native interface of the browser is called to push the designated webpage into the stack as a stack top element.
4. The method according to claim 1, characterized in that: The page operation request includes a page status update request; the method further includes: caching the page status information to be updated of the specified web page carried in the page status update request; After jumping to the designated web page, the designated web page is updated according to the cached page status information to be updated.
5. The method according to claim 4, characterized in that The method further comprises: Detecting whether the specified web page is the current web page; When the designated web page is not the current web page and the processing request is a page status update request, searching in the page stack set in the history record status management middleware whether the designated web page exists; When the designated web page is the current web page, the current web page is updated according to the page status information to be updated carried in the page status update request.
6. The method according to claim 1, characterized in that The historical record status management middleware records the page status information of each historical web page; The method further comprises: When the processing request is a page status acquisition request, The page status information corresponding to the designated web page is searched from the recorded page status information of each historical web page.
7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: When the first entry into the web application is detected, an event declaring proxy page operation history management is triggered; the proxy event includes the proxy processing the processing request for the specified page; Synchronizing the historical web page records of the browser, and initializing a page stack for recording historical web pages and storing page status information of each historical web page according to the historical web page records, to obtain an initialized historical record status management middleware; The page stack and the page status information in the history record status management middleware are updated according to the designated page targeted by each proxy processing request and the processing result of the processing request.
8. A web page processing device, characterized in that: Set in the history record status management middleware, the device includes: The acquisition module is used to receive the processing request sent by the application layer for the specified web page; A search module, used for detecting whether the singleton page stack element mode is enabled when the processing request is a page operation request; When the singleton page stack element mode is enabled, searching whether the specified web page exists in the page stack set in the history record state management middleware is executed; When the singleton page stack element mode is not enabled, calling the second native interface of the browser to push the specified web page into the stack as a page stack element; Update the pointer of the page stack to point to the newly stacked page stack element, so as to jump to the designated web page; In the page stack set in the historical record state management middleware, searching whether the specified web page exists; the page stack elements in the page stack are the recorded historical web pages; different page stack elements are different historical web pages; The jump module is used to call the first native interface of the browser when the specified web page is found, control the pointer of the page stack, move up or down from the current web page in the page stack until it points to the specified web page, so as to jump to the specified web page.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Webpage message return method and webpage message return system
CN106202244A
A method and system for page jump of an application program
CN109358934A
Page skipping method and device for webpage front end
CN110688594A
Small program page display method and device, terminal and storage medium
CN111475246A
Page management method and device
WO2017211174A1
