Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The embodiment of the disclosure first provides a page processing method, as shown in fig. 1, including:
step S11, refusing to stop loading the first page and freezing the content of the first page under the condition that an event of jumping from the first page to the second page is detected;
step S12, in the case of detecting an event of returning to the first page, the first page is converted from a frozen state to an active state.
In this embodiment, the first page may be a web page of a browser or an operation page, a play page, or a presentation page of any APP (Application), or may be any page that needs to obtain information from a server side to be presented at a terminal.
In this embodiment, the terminal may be an electronic device with a function of browsing network information in a page form, such as a desktop computer, a notebook computer, a tablet computer, a mobile phone, an intelligent watch, an intelligent reading device, a palm computer, and an intelligent wearable device.
In this embodiment, the second page may also be a web page of a browser or any operation page, play page, or show page of an APP, or any page that needs to obtain information from a server to be presented at a terminal, or may also be a desktop, a setting interface, a terminal control interface, or other pages different from the first page.
In a specific implementation manner, the event of jumping from the first page to the second page may be an event that the user switches the current display page of the terminal to the second page through the operation instruction in a state that the terminal displays the first page.
For example, the first page may be an M page of the browser, the second page may be a K page of the browser, and when the user browses the M page using the terminal browser, the user jumps to the K page by clicking a link on the M page, so that an event of jumping from the first page to the second page occurs.
For another example, the first page may be an M page of the browser, and the second page may be a K page of the browser, and when the user browses the M page using the terminal browser, the user automatically jumps to the K page through an automatic jump trigger instruction included in the M page, so that an event of jumping from the first page to the second page occurs.
For another example, the first page is one page of the terminal application, the second page is another page of the terminal application, and when the user uses the terminal application, the user jumps from one page of the terminal application to another page of the terminal application through active operation or triggering an automatic jump instruction, so that an event of jumping from the first page to the second page occurs.
For another example, the first page is one page of the terminal application, and the second page is an operation page of an operation tool such as a terminal desktop or a terminal setting. When the user uses the terminal application, by actively issuing an operation instruction, the user jumps from one page of the terminal application to an operation page of an operation tool such as a terminal desktop or a terminal setting, so that an event of jumping from a first page to a second page occurs.
For another example, the first page is a page of the terminal application, and the second page is a terminal function page of terminal call, short message browsing or editing, and the like. When a user browses or operates one page of the terminal application, the terminal generates an operation request interface on one page of the terminal application according to communication information or network information received from other terminals or devices, and the user realizes page switching through the operation request interface, so that an event of jumping from a first page to a second page occurs.
For another example, the first page is a page of a first application of the terminal, the second page is a page of a second application of the terminal, and when the user browses the page of the first application, the user jumps to the page of the second application by means of active operation or triggering an automatic jump instruction and the like.
In this embodiment, the rejection of the stop-loading of the first page may be rejection of the stop-loading operation automatically performed when the jump from the first page to the second page is performed. Specifically, the stopping function or instruction executed when the page jump event occurs can be set to be in an inoperable state, or the original stopping function or instruction is stopped from running continuously when the page jump event occurs.
In this embodiment, the loaded content of the first page may include related information of the first page acquired from the server, that is, all or part of the content of the first page is used for being presented on the terminal display interface.
The loaded content of the first page may further include information related to the progress of the loading of the first page.
The freezing of the content of the first page may be to put the load operation that has been performed by the first page in a suspended frozen state, so that the unloaded portion temporarily stops continuing the loading, and record the content for display of the loaded first page.
In this embodiment, the event of returning to the first page may be an event of returning to the first page from the second page, or an event of returning to the first page from another page, or an event of opening the first page again at the terminal by a user through any way after freezing the first page.
In this embodiment, it may be determined whether an event is detected to return to the first page by combining the available status of some of the resources associated with the display of the first page.
In this embodiment, the first page is converted from the frozen state to the active state, and may be converted from the state of suspending loading to the state of continuing loading.
When the control in the first page is changed to the unavailable state while the first page is frozen, the conversion of the first page to the active state may include restoring the control in the first page to the available state.
Converting the first page from the frozen state to the active state may include activating all relevant functions of the first page including a load function, a control function, a play function, and the like.
The page processing method of the embodiment of the disclosure can be applied to web pages Webview (webpage view) of an Android (Android) system, and under the general condition that the Android Webview page is jumped, especially when the page is clicked to jump another page quickly and returned to the original page, page layout and resource loading abnormality problems such as incomplete page display, incapable picture display, JS (Java Script) control execution failure and the like can occur when the page is returned to the previous page after the jump, because operations such as the analysis of the page before the jump is triggered after the jump, the loading of main document data and the like are triggered after the jump.
In the embodiment, when a user jumps or switches from a first page to a second page, the loading operation on the first page is not actively stopped, but the content of the first page is frozen, after the first page is returned, the first page is activated, so that the unloaded content of the first page can be continuously loaded under the condition that the unloaded content exists in the first page, the unloaded content cannot be lost after the first page is returned, and meanwhile, after the first page is returned, the first page is activated, the related function control of the first page can be in an activated state, and under the condition that the first page does not need to be refreshed, the condition that the user cannot operate the first page after the first page is returned is avoided, and the user experience is improved.
In one embodiment, as shown in FIG. 2, freezing the content of the first page includes:
step S21, caching the loaded content of the first page;
step S22, calling a freezing interface of the page life cycle (PAGE LIFE CIRCLE) system to set the first page to be in a frozen state.
The content loaded on the first page is cached, that is, the relevant information of the first page acquired from the server is put into a buffer storage area (Cache), and the information such as the JS control function, loading progress and the like of the first page is also put into the buffer storage area.
In this embodiment, the page lifecycle system divides the lifecycle of a page into six phases, each of which is only one of the phases at a time. Mainly comprises an Active phase, a Passive phase, a Hidden phase, a Terminated phase, a Frozen phase and a Discard phase.
In the Active phase, the web page is in a visible state and has an input focus. In the Passive phase, the web page is visible, but there is no input focus, and input is not accepted. UI (User Interface) updates (such as animations) are still executing. This phase can only occur when there are multiple windows on the desktop at the same time. In the Hidden phase, the user's desktop is occupied by other windows, the web page is not visible, but has not been frozen. The UI update is no longer performed. In the Terminated phase, the current page starts to be unloaded by the browser and purged from memory, either because the user is actively closing the window, or is going to other pages in the same window. The Terminated phase results in web page uninstallation, at which point no new tasks will start, and if the run time is too long, the ongoing tasks may be Terminated. If the web page is in the Hidden phase for too long, the user does not close the web page, and the browser may freeze the web page and enter the Frozen phase. However, it is also possible that a page in the visible state does not operate for a long time, and would enter the Frozen stage.
The Frozen phase is characterized in that the web page is no longer allocated CPU (Central Processing Unit ) computing resources. The timer, callback function, web request, DOM (Document Object Model ) operations are not performed, but the running task is performed. The browser may allow the Frozen-phase page to periodically resuscitate for a short period of time, briefly returning to the Hidden state, allowing a small portion of the task to execute.
If the web page is in the Frozen stage for a long time and the user does not wake up the page, the page enters the DISCARDED stage, i.e. the browser automatically unloads the web page and clears the memory occupation of the web page. If the web page in the Passive stage has no interaction for a long time, the web page may also directly enter the DISCARDED stage.
The process of entering the Discard phase is typically enforced by the system without user intervention. Any type of new task or JavaScript code cannot be executed at this stage, as this is typically in the context of resource limitations.
After the web page is automatically DISCARDED by the browser, its page window is still in place. If the user revisits the page, the browser will send a request to the server again to reload the web page again, and return to the Active stage.
In this embodiment, each stage of the page lifecycle system has a corresponding interface, and the web page can be in a corresponding stage by calling the corresponding interface. Meanwhile, in this embodiment, the page may be rejected from entering the Discard stage within a certain period of time after the page enters the Frozen stage, that is, the Frozen state may be maintained within a certain period of time.
In another possible implementation manner, the operation of setting the page state to the frozen state through the frozen interface of the page lifecycle system is not only applicable to the web page of the browser, but also applicable to other H5 pages or other application interfaces or pages, and the like.
In this embodiment, after the content recorded on the first page is cached, the first page is frozen, the loaded content of the first page is reserved, and the loading of the first page is in a state of being suspended and not being invalid.
In one embodiment, transitioning the first page from the frozen state to the active state includes:
and calling an active interface of the page life cycle system, and setting the first page from the frozen state to the active state.
In this embodiment, the active interface of the page lifecycle system may be used to transition a web page or other H5 page from an inactive state to an active state.
After setting the first page from the frozen state to the active state, an incomplete load operation can be performed on the first page.
In this embodiment, the first page is set from the frozen state to the active state, so that after the user returns to the first page, the user can continue to browse or perform other operations on the first page normally without refreshing the first page, thereby improving user experience.
In one embodiment, the page processing method further includes:
Setting the loaded content of the first page as a current list item;
rendering the current list item to obtain the display content of the current window.
In this embodiment, the current list item may be a current item to be displayed, and in particular may be a buffer queue of information to be displayed.
Rendering the current list item can include converting the current list item to generate texture information which can be used for display, and displaying the texture information which can be used for display to obtain display content of the current window.
In the embodiment, the loaded content of the first page is directly used for display, so that reloading of the loaded content is not needed, resources are saved, secondary display of information watched by a user is avoided, and user experience is improved.
In one embodiment, the page processing method further includes:
Loading other content of the first page in addition to the loaded content;
Other content is rendered to the current window in addition.
In this embodiment, in addition to the loaded content, the other content of the first page may be loaded, where the unloaded content exists in the first page.
For example, before the first page jumps to the second page, the first page has all the text and hyperlinks loaded, but the picture is not loaded, after the first page is returned, the loaded text and hyperlinks are rendered and displayed, the picture continues to be loaded, and as the loading is carried out, the picture of the first page is additionally displayed on the basis of the rendered part of the first page.
In this embodiment, the content that is not loaded before the first page is skipped can be loaded in a complementary manner, so that the situation of incomplete display after the first page is returned can be avoided, and user experience is improved.
In an example of the disclosure, the page processing method may freeze the page through a keep-alive mechanism under the condition that the page jumps, and after the page is returned, the page can still be continuously loaded or normally displayed and used, so that user experience is significantly improved.
In this example, the first page may be an A page of a browser or other application and the second page may be a B page of the browser or other page. When the link is clicked from the page A to the page B, the page analysis and data loading operation of the page A are not executed, the page A is kept in an active state, and the page A is kept alive. But the a page in the background continues to perform parsing and continues to load resources, which must affect the speed of the newly opened B page, and in order to optimally solve this problem, a multi-page keep-alive mechanism PAGE LIFE CYCLE is used.
When the link is clicked from the A page to the B page under the mechanism of the multi-page keep-alive combination PAGE LIFE CYCLE, under the condition that the A page is kept alive, the A page is controlled through the PAGE LIFE CYCLE state, the A page is set to be in the Frozen state, and the analysis operation and the resource loading aiming at the A page are suspended. When the user returns to the A page from the B page, the A page is set to be in an Active state through PAGE LIFE CYCLE state control, and the analysis and loading of the A page are restored, so that the problem can be perfectly solved.
PAGE LIFE CYCLE the state control can be packaged to the application of the Android system through a newly added Webview interface.
Fig. 3A and 3B illustrate two stages of a page processing method of an embodiment of the present disclosure, respectively.
As shown in fig. 3A, when the user jumps from the clicking link of the a page to the B page, the resolving and data loading operations of the a page are not actively stopped, the a page is kept alive, and the a page is controlled through a PAGE LIFE CYCLE state mechanism, so that the a page is in a Frozen (Frozen) state, and resolving and resource loading for the a page are suspended. The B page is in an Active state.
As shown in fig. 3B, when the user returns from the B page to the a page, the a page is controlled to be in an Active state by PAGE LIFE CYCLE state mechanism, so as to resume the analysis and resource loading of the a page, and the a page normally continues to load and display. The B page is then in the go (closed) state.
Therefore, the embodiment of the disclosure solves the problems of incomplete page A display and resource loading caused by clicking the page A to jump to the page B by setting the unified multi-page keep-alive jump processing strategy, and effectively improves the user experience. The page processing method provided by the embodiment of the disclosure is suitable for all H5 page scenes opened by Android Webview, and has a wide application range.
The embodiment of the disclosure further provides a page processing device, as shown in fig. 4, including:
a freezing module 41, configured to refuse to stop loading the first page and freeze the content of the first page if an event of jumping from the first page to the second page is detected;
An activity module 42 for switching the first page from the frozen state to the active state in case an event is detected that the first page is returned.
In one embodiment, as shown in fig. 5, the freezing module includes:
a caching unit 51, configured to cache the loaded content of the first page;
And a freeze interface unit 52, configured to invoke a freeze interface of the page lifecycle system to set the first page to a frozen state.
In one embodiment, the activity module is further to:
and calling an active interface of the page life cycle system, and setting the first page from the frozen state to the active state.
In one embodiment, as shown in fig. 6, the page processing apparatus further includes:
a list item module 61, configured to set the loaded content of the first page as a current list item;
and the rendering module 62 is used for rendering the current list item to obtain the display content of the current window.
In one embodiment, the page processing apparatus as shown in fig. 7 further includes:
the other content loading module 71 is configured to load other content of the first page in addition to the loaded content;
the complementary rendering module 72 is used for complementary rendering of other content to the current window.
The embodiment of the disclosure can be applied to the technical field of computers, in particular to the technical fields of searching, information flow, mobile internet, web page view, intelligent terminals and the like.
In the technical scheme of the disclosure, the acquisition, storage, application and the like of the related user personal information all conform to the regulations of related laws and regulations, and the public sequence is not violated.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
Fig. 8 illustrates a schematic block diagram of an example electronic device 800 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 8, the apparatus 800 includes a computing unit 801 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 802 or a computer program loaded from a storage unit 808 into a Random Access Memory (RAM) 803. In the RAM803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to the bus 804.
Various components in the device 800 are connected to the I/O interface 805, including an input unit 806, such as a keyboard, a mouse, etc., an output unit 807, such as various types of displays, speakers, etc., a storage unit 808, such as a magnetic disk, optical disk, etc., and a communication unit 809, such as a network card, modem, wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The computing unit 801 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 801 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the respective methods and processes described above, for example, a page processing method. For example, in some embodiments, the page processing method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program may be loaded and/or installed onto device 800 via ROM 802 and/or communication unit 809. When a computer program is loaded into RAM 803 and executed by computing unit 801, one or more steps of the page processing method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the page processing method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include being implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be a special or general purpose programmable processor, operable to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user, for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback), and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a Local Area Network (LAN), a Wide Area Network (WAN), and the Internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server incorporating a blockchain.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel or sequentially or in a different order, provided that the desired results of the technical solutions of the present disclosure are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure are intended to be included within the scope of the present disclosure.