Method, device and electronic device for obtaining browsing page fault
By receiving registration requests and heartbeat packets through the browser service module and establishing a timer to monitor browsing page failures, the problem of inaccurate acquisition of browsing page failure events is solved, achieving higher monitoring accuracy and reducing server load.
Patent Information
- Application Number
- CN202110126883.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-29
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2041-01-29
AI Technical Summary
In existing technologies, the accuracy of obtaining browsing page failure events needs to be improved in certain scenarios (such as when the user forcibly closes the browser), resulting in the inability to accurately monitor browsing page failures.
The browser's service module receives the registration request from the browsing process, establishes a timer, and receives heartbeat packets periodically sent by the browsing process. If no heartbeat packet is received within a preset time, a failure event of the browsing page is determined.
It improves the accuracy of browsing page failure monitoring, especially when the browser is forcibly closed, it can accurately obtain failure events and reduce the pressure on the server.
Smart Images

Figure CN112905411B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of Internet technology, and in particular to a method, device and electronic device for obtaining browsing page failures. Background Art
[0002] At present, when users use browsers, there may be cases where the browsing page crashes. When the browsing page crashes, the browsing page cannot respond to user operations, affecting the normal use of users. By obtaining the browsing page failure event, it is possible to diagnose, locate and repair the failure.
[0003] In the related art, a tag is written for the browsing page and the tag is used to determine whether the browsing page has a fault. However, this solution cannot obtain the browsing page fault event in some scenarios, such as the scenario where the user forcibly closes the browser. The accuracy of obtaining the browsing page fault event needs to be improved. Summary of the invention
[0004] The present disclosure provides a method, device and electronic device for obtaining browsing page faults, so as to at least solve the problem that the accuracy of obtaining browsing page fault events in the related art needs to be improved. The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, a method for obtaining a browsing page fault is provided, which is executed by a service module in a browser, and the method includes:
[0006] receiving a registration request, wherein the registration request is sent by a browsing process of a browsing page, and the registration request includes an identifier of the browsing page;
[0007] Establishing a timer for the browsing process according to the registration request;
[0008] Receiving a heartbeat packet, wherein the heartbeat packet is periodically sent by the browsing process;
[0009] When the heartbeat packet is not received within a preset time, a fault event of the browsing page is determined, wherein the timer triggers the fault event after the preset time.
[0010] In a possible implementation manner of the embodiment of the present disclosure, the heartbeat packet includes an identifier of the browsing page, and after receiving the heartbeat packet, the method further includes:
[0011] Determining a timer corresponding to the identifier of the browsing page;
[0012] The timing time of the timer corresponding to the identifier of the browsing page is updated.
[0013] In a possible implementation manner of the embodiment of the present disclosure, the registration request includes a category identifier corresponding to the browsing page, and establishing a timer for the browsing process according to the registration request includes:
[0014] Determining preset times corresponding to a plurality of browsing processes respectively according to the category identifier;
[0015] The timer is established for the browsing process according to the preset times respectively corresponding to the multiple browsing processes.
[0016] In a possible implementation of the embodiment of the present disclosure, the method further includes:
[0017] Receiving a page exit message sent by a browsing process of the browsing page;
[0018] The timer corresponding to the browsing process is closed according to the page exit message.
[0019] In a possible implementation manner of the embodiment of the present disclosure, after determining the failure event of the browsing page, the method further includes:
[0020] Determining a trigger time of the timer;
[0021] The failure event of the browsing page and the trigger time are sent to the browser, wherein the browser generates and displays page abnormality information according to the failure event of the browsing page and the trigger time.
[0022] According to a second aspect of an embodiment of the present disclosure, a device for obtaining a browsing page fault is provided, comprising:
[0023] A first receiving unit is configured to receive a registration request, wherein the registration request is sent by a browsing process of a browsing page, and the registration request includes an identifier of the browsing page;
[0024] an establishing unit, configured to execute establishing a timer for the browsing process according to the registration request;
[0025] A second receiving unit is configured to receive a heartbeat packet, wherein the heartbeat packet is periodically sent by the browsing process;
[0026] The first determining unit is configured to determine a fault event of the browsing page when the heartbeat packet is not received within a preset time, wherein the timer triggers the fault event after the preset time.
[0027] In a possible implementation manner of the embodiment of the present disclosure, the heartbeat packet includes an identifier of the browsing page, and the device further includes:
[0028] A second determining unit is configured to execute determining a timer corresponding to the identifier of the browsing page;
[0029] The updating unit is configured to update the timing time of the timer corresponding to the identifier of the browsing page.
[0030] In a possible implementation manner of the embodiment of the present disclosure, the registration request includes a category identifier corresponding to the browsing page, and the establishing unit is specifically configured to:
[0031] Determining preset times corresponding to the plurality of browsing processes respectively according to the category identifier;
[0032] The timer is established for the browsing process according to the preset times respectively corresponding to the multiple browsing processes.
[0033] In a possible implementation of the embodiment of the present disclosure, the device further includes:
[0034] A third receiving unit is configured to receive a page exit message sent by a browsing process of the browsing page;
[0035] The closing unit is configured to execute a timer corresponding to closing the browsing process according to the page exit message.
[0036] In a possible implementation of the embodiment of the present disclosure, the device further includes:
[0037] A third determining unit is configured to determine a triggering time of the timer;
[0038] The sending unit is configured to send the failure event of the browsing page and the trigger time to the browser, wherein the browser generates and displays page exception information according to the failure event of the browsing page and the trigger time.
[0039] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0040] processor;
[0041] a memory for storing instructions executable by the processor;
[0042] The processor is configured to execute the instructions to implement the method for obtaining browsing page faults as described above.
[0043] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor, the method for obtaining browsing page faults as described above can be executed.
[0044] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program product, and when the computer program is executed by a processor, the computer program product can execute the method for obtaining browsing page faults as described above.
[0045] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0046] The service module of the browser receives a registration request sent by a browsing process of a browsing page, wherein the registration request includes an identifier of the browsing page, and a timer is established for the browsing process according to the registration request. The browsing process of the browsing page periodically sends a heartbeat packet to the service module of the browser, and the heartbeat packet is received by the service module of the browser. If the heartbeat packet is not received within a preset time, a fault event of the browsing page is determined. Thus, by monitoring the heartbeat packet and judging whether the page is faulty through the service module, the fault event of the browsing page can be accurately obtained, thereby improving the accuracy of the monitoring of the fault of the browsing page.
[0047] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0049] Figure 1 The figure is a flow chart of a method for obtaining browsing page faults according to an exemplary embodiment.
[0050] Figure 2 The figure is a flow chart of another method for obtaining browsing page faults according to an exemplary embodiment.
[0051] Figure 3 The present invention is a flowchart of sending a heartbeat packet according to an exemplary embodiment.
[0052] Figure 4 The present invention is a flowchart of monitoring heartbeat packets according to an exemplary embodiment.
[0053] Figure 5 The figure is a flow chart of another method for obtaining browsing page faults according to an exemplary embodiment.
[0054] Figure 6 The present invention is a block diagram of a device for obtaining browsing page failure according to an exemplary embodiment.
[0055] Figure 7 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0056] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0057] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0058] Currently, when a user browses a page, the page may crash. By obtaining the browsing page's failure event, the failure can be diagnosed, located, and repaired.
[0059] In the related art, a tag is written for the browsing page, and the tag is used to determine whether a failure occurs when the page is entered next time. This solution is suitable for the scenario where the user reopens the crashed page in the current tab after the page crashes. However, for some scenarios where it is impossible to obtain the failure event of the browsing page, such as the scenario where the user forcibly closes the browser, the accuracy of obtaining the browsing page failure needs to be improved.
[0060] Based on this, the embodiment of the present disclosure shows a method for obtaining a browsing page fault. The method for obtaining a browsing page fault in the embodiment of the present disclosure can be applied to a client, and specifically, can be implemented by a service module of a browser on the client side. Figure 1 To explain, Figure 1 is a flow chart of a method for obtaining a browsing page fault according to an exemplary embodiment. Figure 1 As shown, the method for obtaining browsing page faults includes steps 101 to 104.
[0061] Step 101: Receive a registration request.
[0062] In the disclosed embodiment, the service module of the browser receives a registration request, wherein the registration request is sent by a browsing process of a browsing page, and the registration request includes an identifier of the browsing page.
[0063] The browser is an application used to retrieve, display and transmit information resources, such as web pages, pictures, videos and other content marked by uniform resource identifiers. The browser includes a browsing page, and the number of browsing pages can be one or more. For example, web pages, pictures, videos and other content can be displayed through the browsing page of the browser.
[0064] The service module may be a service process in the browser. The service process is independent of the browsing page. When the JavaScript thread or part of the process of the browsing page crashes, it will not affect the operation of the service process. Therefore, in the embodiment of the present disclosure, the browsing page is monitored for faults through the service process.
[0065] Optionally, the service process can be implemented based on the Service Worker process. The Service Worker is an event-driven process registered under a specified source and path, which can intercept and modify the browser's resource requests and cache resources. The browser establishes the Service Worker process by registering.
[0066] It should be noted that the service module is not located on the server. Monitoring the browsing process status through the service module reduces the server pressure and distributes the pressure on the client.
[0067] In the disclosed embodiment, the browser also includes a browsing process, and the browsing page corresponds to the browsing process. For example, one browsing page corresponds to one browsing process. When there are multiple browsing pages, multiple browsing pages correspond to multiple browsing processes, and multiple browsing pages correspond one-to-one to multiple browsing processes.
[0068] The browsing page identifier is used to distinguish the browsing page, and different browsing pages correspond to different identifiers. Optionally, the browsing page identifier may be a UUID (Universally Unique IDentifier) or a unique identifier generated for each browsing page.
[0069] Step 102: Establish a timer for the browsing process according to the registration request.
[0070] In this embodiment, the service module establishes a timer for the browsing process according to the registration request. For example, the registration request sent by the browsing process includes the identifier of the browsing page, and the service module establishes a timer according to the identifier of the browsing page, and determines the corresponding relationship between the identifier of the browsing page and the timer. When the timer triggers a fault event, the service module can determine the browsing page corresponding to the fault event according to the identifier of the browsing page corresponding to the timer, so as to accurately determine the browsing page that has a fault from multiple browsing pages.
[0071] Step 103, receiving a heartbeat packet.
[0072] In the disclosed embodiment, the service module of the browser receives the heartbeat packet, wherein the heartbeat packet is periodically sent by the browsing process of the browsing page.
[0073] Wherein, the browsing process is used to periodically send a heartbeat packet to the service module. The period for which the browsing process sends the heartbeat packet to the service module can be set as needed. For example, if the period is T, the browsing process sends the heartbeat packet to the service module every T time. To ensure that the service module accurately determines when the browsing page crashes, the browsing process of the browsing page can send a heartbeat packet to the service module at all times, for example, the browsing process of the browsing page sends a heartbeat packet to the service module every second.
[0074] Step 104: If no heartbeat packet is received within a preset time, a failure event of the browsing page is determined.
[0075] In the disclosed embodiment, the service module determines whether a heartbeat packet is received within a preset time, and determines a failure event of the browsing page if the heartbeat packet is not received within the preset time. Optionally, the timer triggers a failure event after the preset time, for example, if the service module does not receive a heartbeat packet within the preset time, the timer triggers a failure event.
[0076] As an example, the browsing process periodically sends a heartbeat packet to the service module, and the heartbeat packet includes heartbeat information. The service module determines whether the heartbeat packet is received within a preset time. If the heartbeat packet is not received within the preset time, the service module determines that a failure event occurs in the browsing page corresponding to the browsing process, and then the service module reports the failure event of the browsing page to the browser. Optionally, the preset time can refer to a time period not exceeding the preset time, and the preset time can be set to be greater than or equal to the sending period of the heartbeat packet.
[0077] When the browsing page is running normally, the browsing process of the browsing page will periodically send a heartbeat packet to the service module, and when the browsing page fails, the browsing process of the browsing page cannot send a heartbeat packet to the service module, and the service module also cannot receive the heartbeat packet sent by the browsing process. Therefore, the service module determines whether the heartbeat packet is not received within the preset time. If the heartbeat packet is not received within the preset time, it is considered that the browsing page fails. If the heartbeat packet is received within the preset time, it is considered that the browsing page does not fail. For example, the preset time can be set to be slightly larger than the sending cycle of the heartbeat packet (for example, the sending cycle is 1 second, and the preset time is 1.1 seconds). If the service module does not receive the heartbeat packet within the preset time, it is determined that the browsing page fails, and the service module reports the failure event of the browsing page failure. The failure event, for example, includes the collapse of the browsing page, and can also include other events that cause the browsing process to be unable to normally send a heartbeat packet.
[0078] It should be noted that the above description is only an example and the present disclosure does not impose any specific limitation on this.
[0079] The disclosed embodiment provides a method for obtaining browsing page faults, wherein a registration request sent by a browsing process of a browsing page is received through a service module of a browser, wherein the registration request includes an identifier of the browsing page, and a timer is established for the browsing process according to the registration request. The service module of the browser receives a heartbeat packet periodically sent by the browsing process of the browsing page, and when no heartbeat packet is received within a preset time, the service module determines a fault event of the browsing page. Thus, by monitoring the heartbeat packet and determining whether the page is faulty through the service module, even in the scenario of forcibly closing the browser, the fault event of the browsing page can be accurately obtained, thereby improving the accuracy of browsing page fault monitoring, and implementing browsing page fault monitoring based on the service module in the browser, without the need to send a heartbeat packet to the server, thereby reducing the cost of the server.
[0080] In actual applications, it is very common to open multiple browsing pages in one browser. In the embodiment of the present disclosure, accurate acquisition of fault events can also be achieved for the situation of multiple browsing pages. Figure 2 is a flow chart showing another method for obtaining a browsing page fault according to an exemplary embodiment. Figure 2 As shown, the method includes steps 201 to 204.
[0081] Step 201: receiving a registration request for a browsing process, wherein the registration request includes an identifier of a browsing page.
[0082] In the disclosed embodiment, the browser may have multiple browsing pages, and the multiple browsing pages correspond to multiple browsing processes. The number of browsing pages is the same as the number of browsing processes, and the multiple browsing pages correspond to the multiple browsing processes one by one. Optionally, the browser may establish a service module for the multiple browsing pages, and the multiple browsing processes may correspond to one service module, that is, establish one service module, and implement fault monitoring of the multiple browsing pages according to the one service module.
[0083] Step 202: Establish a timer for the browsing process according to the registration request, wherein the timer triggers a fault event after a preset time.
[0084] In this embodiment, the service module establishes multiple timers for multiple browsing processes, wherein the timers trigger a fault event after a preset time. Multiple browsing processes correspond to multiple timers, the number of timers is the same as the number of browsing processes, and the multiple timers correspond to the multiple browsing processes one by one. Optionally, the preset times corresponding to the multiple timers can be the same or different, which is not specifically limited here.
[0085] Step 203: Receive a heartbeat packet.
[0086] In the disclosed embodiment, multiple browsing pages correspond to multiple browsing processes, and the browser controls the multiple browsing processes to periodically send heartbeat packets to the service module. Optionally, the periods at which the multiple browsing processes send heartbeat packets to the service module may be the same or different, which is not specifically limited here.
[0087] The heartbeat packet includes the browsing page identifier and the heartbeat information. Different browsing processes correspond to different browsing page identifiers, and the browsing page identifier can be a UUID or a unique identifier generated for each browsing page. The heartbeat information is used to update the timer, and the heartbeat information in each heartbeat packet can be the same.
[0088] Step 204: determine the timer corresponding to the browsing page identifier, and update the timing time of the timer corresponding to the browsing page identifier.
[0089] In this embodiment, the service module determines the timer corresponding to the identification of the browsing page according to the identification of the browsing page in the heartbeat packet, and updates the timing time of the timer corresponding to the identification of the browsing page, so that the timer corresponding to the identification of the browsing page restarts the timing. For example, when the timer is timing, the timing time gradually increases. When the timing time is greater than the preset time of the timer, the timer triggers the fault time. In this example, updating the timing time of the timer can be to reset the timing time to zero so that the timer restarts the timing. Since the identification of the browsing page is included in the heartbeat packet, the service module can determine the timer that needs to be updated according to the identification of the browsing page, ensure the accuracy of the timer update, and provide a guarantee for the accurate monitoring of the browsing page failure event.
[0090] Step 205: If no heartbeat packet is received within a preset time, a failure event of the browsing page is determined.
[0091] In this embodiment, if the heartbeat packet is not received within the preset time, the timer established by the service module triggers a fault event. If the service module does not receive a heartbeat packet again after a preset time after receiving a heartbeat packet once, and the timing time of the timer is greater than the preset time, the timer is triggered. If a timer is triggered after the preset time, the service module determines the browsing process and browsing page corresponding to the timer, and reports the fault event of the browsing page, and optionally, the fault event includes a page crash.
[0092] For example, taking two browsing pages as an example, the service module establishes two timers, wherein the first browsing page corresponds to the first browsing process, the first identifier and the first timer, and the second browsing page corresponds to the second browsing process, the second identifier and the second timer. The first browsing process periodically sends the first heartbeat packet to the service module, and the second browsing process periodically sends the second heartbeat packet to the service module, wherein the first heartbeat packet includes the first identifier and the heartbeat information, and the second heartbeat packet includes the second identifier and the heartbeat information. After receiving the first heartbeat packet, the service module updates the first timer, and after receiving the second heartbeat packet, updates the second timer. If the first timer is triggered after the preset time, the service module reports the fault event of the first browsing page, and if the second timer is triggered after the preset time, the service module reports the fault event of the second browsing page. Thus, for the case of multiple browsing pages, the browsing page that has failed can be accurately obtained and the fault event can be reported, thereby improving the accuracy of browsing page monitoring.
[0093] In one embodiment of the present disclosure, after determining the failure event of the browsing page, the service module can also determine the trigger time of the timer, and send the failure event of the browsing page and the trigger time to the browser. The browser generates and displays page abnormality information according to the failure event of the browsing page and the trigger time.
[0094] Optionally, when the timer triggers a fault event, the current time of the fault event is determined as the trigger time, and the service module can determine the browsing page where the fault occurs based on the identifier of the browsing page corresponding to the timer. Furthermore, the service module reports the trigger time and the fault event of the browsing page to the browser, and the browser generates page exception information of the browsing page based on the trigger time and the fault event of the browsing page. For example, if the fault event includes a page crash, the page exception information may include the crashed page and the crash time.
[0095] In this way, page exception information of the browsing page can be provided to the user, so that the user can be informed of the failure events of the browsing page in time. Moreover, since the service module is not located on the server, the failure events of the browsing page can be monitored and determined by the service module, which reduces the server pressure and disperses the pressure on the client.
[0096] In actual applications, when a browsing page is closed normally, the browsing process corresponding to the browsing page will also stop sending heartbeat packets.
[0097] Therefore, in order to avoid false alarms, in one embodiment of the present disclosure, when a browsing page is closed, the browsing process of the browsing page sends a page exit message to the service module, and the service module turns off the timer corresponding to the browsing process according to the page exit message of the browsing process. For example, the page exit message includes the identifier of the browsing page, and after the service module receives the page exit message, it turns off the timer corresponding to the identifier according to the identifier of the browsing page in the page exit message, so as to avoid the timer being triggered and reporting a fault event after exceeding a preset time after the browsing page is normally closed. In this way, the fault event of the browsing page can be accurately obtained, so as to avoid misreporting the normal exit of the browsing page as a browsing page fault.
[0098] The following is an explanation of sending heartbeat packets for the browsing process.
[0099] Reference Figure 3 , the browsing process of the browsing page executes the step of starting the service module, and then the browsing process periodically sends a heartbeat packet to the service module, and the heartbeat packet contains heartbeat information. If the browsing page is not exited, the browsing process continues to periodically send heartbeat packets to the service module; if the browsing page is exited normally, the browsing process sends a page exit message to the service module.
[0100] In actual applications, before the browsing process periodically sends a heartbeat packet to the service module, an operation of starting the service module can be performed to ensure that the method for obtaining browsing page faults of the embodiment of the present disclosure can be normally executed in various scenarios.
[0101] As an example, the browsing process of the browsing page executes the step of starting the service module. If the service module is not started, the service module is started according to the startup steps executed by the browsing process, and then the browsing process periodically sends a heartbeat packet to the service module. It should be noted that if the service module is already started, the browsing process executing the step of starting the service module has no effect.
[0102] In this example, after the service module is started, at least the service module and the browsing process already exist. As a possible implementation method, the browsing process can send information to the service module through the relevant interface. Specifically, the browsing process interacts with the service module through the postMessageAPI (postMessage Application Programming Interface) to periodically send heartbeat packets.
[0103] The following describes how the service module receives the heartbeat packet.
[0104] Reference Figure 4The service module receives the heartbeat packet sent periodically by the browsing process and determines whether the heartbeat packet is received within the preset time. If the heartbeat packet is received within the preset time, the timer is updated and the heartbeat is continued to be monitored; if the heartbeat packet is not received within the preset time, the browsing page crash event is reported.
[0105] In the disclosed embodiment, after receiving the fault event reported by the service module, the browser sends the fault event to the server. By establishing a service module for the browsing page, judging whether the browsing page crashes according to the service module, and communicating with the server only when the browsing page crashes, the pressure on the server is reduced.
[0106] The method for obtaining browsing page faults in the disclosed embodiment establishes multiple timers for multiple browsing processes through a service module, and updates the corresponding timers according to the identifier of the browsing page in the heartbeat packet. When the timer is triggered after a preset time, the fault event of the corresponding browsing page is reported. In this way, the browsing page with a fault can be accurately obtained from multiple browsing pages and the fault event can be reported, thereby improving the accuracy of browsing page monitoring.
[0107] In some embodiments of the present disclosure, the triggering time of the timer may be specifically determined for different browsing pages to improve the accuracy of browsing page fault acquisition. Figure 5 is a flow chart showing another method for obtaining a browsing page fault according to an exemplary embodiment. Figure 5 As shown, the method includes: step 501-step 502.
[0108] Step 501: Determine the preset time corresponding to each browsing process according to the category identifier of the browsing page.
[0109] In this embodiment, the registration request sent by the browsing process includes a category identifier corresponding to the browsing page.
[0110] In actual applications, there are usually various browsing pages, such as browsing pages containing text content and browsing pages containing video content, to meet users' browsing needs for various information.
[0111] In the disclosed embodiment, the browser has multiple browsing pages, and the multiple browsing pages correspond to multiple browsing processes. When the service module establishes multiple timers for the multiple browsing processes, the browser can obtain the category identifiers corresponding to the multiple browsing pages.
[0112] Among them, the category identifier is used to indicate the category of the browsing page. Each browsing page may correspond to a category identifier. The category identifier of the browsing page may be determined based on the web page elements contained in the browsing page. The web page elements may include text, pictures, audio, animation, video, etc.
[0113] As an example, if the web page elements in the browsing page include text, it can be determined that the category identifier corresponding to the browsing page indicates the text web page category; if the web page elements in the browsing page include video, it can be determined that the category identifier corresponding to the browsing page indicates the video web page category.
[0114] As another example, all web page elements in a browsing page can be obtained, and the category identification of the browsing page can be determined based on the content contained in all web page elements in the browsing page, the proportion or quantity of each type of content. For example, the web page elements in the browsing page include pictures and videos, and the category identification of the browsing page is determined based on the number of pictures and video content.
[0115] In this example, the category identifier corresponding to the browsing page is obtained when the browsing page is opened. For example, when a link is triggered and the browsing page pointed to by the link is loaded, the web page elements of the browsing page are obtained and the category identifier of the browsing page is determined based on the web page elements. Alternatively, a corresponding category identifier may be set for each browsing page in advance and stored, and when the link is triggered and the browsing page is loaded, the category identifier of the browsing page is obtained through query.
[0116] In the disclosed embodiment, different categories of browsing pages may correspond to different preset times, and the preset time refers to the time when the timer is triggered. That is, a correspondence between a category identifier and a preset time may be established in advance, and when a service process establishes a timer for a browsing process, the preset times corresponding to the multiple browsing processes are determined according to the category identifier and the correspondence. The preset times corresponding to the multiple browsing processes may be different.
[0117] Step 502: establishing a timer for the browsing process according to the preset times respectively corresponding to the plurality of browsing processes.
[0118] In the disclosed embodiment, the service module establishes multiple timers for multiple browsing processes, wherein when establishing the timers, the timers are set to be triggered after the preset time according to the preset times corresponding to the above-mentioned multiple browsing processes. For example, taking browsing process 1 and browsing process 2 as examples, for browsing process 1, preset time 1 is determined according to the category identifier of the corresponding browsing page, then the service module establishes timer 1 for browsing process 1, and timer 1 is triggered after preset time 1, and for browsing process 2, which corresponds to preset time 2, the service module establishes timer 2 for browsing process 2, and timer 2 is triggered after preset time 2.
[0119] The method for obtaining browsing page faults in the disclosed embodiment determines preset times corresponding to multiple browsing processes through category identifiers corresponding to multiple browsing pages, and the service module establishes multiple timers for the multiple browsing processes according to the preset times corresponding to the multiple browsing processes. Thus, it is possible to determine the triggering time of the timer according to the category of the browsing page, so that the timer is triggered after the corresponding time, further improving the accuracy of browsing page fault monitoring.
[0120] Figure 6 is a block diagram of a device for obtaining a browsing page fault according to an exemplary embodiment. Figure 6 As shown, the device for obtaining browsing page faults includes: a first receiving unit 610 , an establishing unit 620 , a second receiving unit 630 , and a first determining unit 640 .
[0121] The first receiving unit 610 is configured to receive a registration request, wherein the registration request is sent by a browsing process of a browsing page, and the registration request includes an identifier of the browsing page.
[0122] The establishing unit 620 is configured to establish a timer for the browsing process according to the registration request.
[0123] The second receiving unit 630 is configured to receive a heartbeat packet, wherein the heartbeat packet is periodically sent by the browsing process.
[0124] The first determining unit 640 is configured to determine a failure event of the browsing page when no heartbeat packet is received within a preset time, wherein the timer triggers the failure event after the preset time.
[0125] In a possible implementation of the embodiment of the present disclosure, the heartbeat packet includes an identifier of the browsing page, and the device for obtaining the browsing page fault further includes:
[0126] A second determining unit is configured to execute a timer corresponding to the identifier of the browsing page;
[0127] The updating unit is configured to execute updating of the timing time of the timer corresponding to the identifier of the browsing page.
[0128] In a possible implementation of the embodiment of the present disclosure, the registration request includes a category identifier corresponding to the browsing page, and the establishing unit 620 is specifically configured to:
[0129] Execute the preset time corresponding to each of the plurality of browsing processes according to the category identifier;
[0130] The timer is established for the browsing process according to the preset times respectively corresponding to the multiple browsing processes.
[0131] In a possible implementation of the embodiment of the present disclosure, the device for obtaining browsing page faults further includes:
[0132] A third receiving unit is configured to receive a page exit message sent by a browsing process of the browsing page;
[0133] The closing unit is configured to execute a timer corresponding to closing the browsing process according to the page exit message.
[0134] In a possible implementation of the embodiment of the present disclosure, the device for obtaining browsing page faults further includes:
[0135] A third determining unit is configured to determine a triggering time of the timer;
[0136] The sending unit is configured to send the failure event of the browsing page and the trigger time to the browser, wherein the browser generates and displays page exception information according to the failure event of the browsing page and the trigger time.
[0137] In actual use, the browsing page fault acquisition device provided in the embodiment of the present disclosure can be configured in any electronic device to execute the aforementioned browsing page fault acquisition method. Therefore, regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0138] The browsing page fault acquisition device provided by the embodiment of the present disclosure receives a registration request sent by the browsing process of the browsing page through the service module of the browser, the registration request includes the identification of the browsing page, and establishes a timer for the browsing process according to the registration request. The service module of the browser receives the heartbeat packet periodically sent by the browsing process of the browsing page, and when the heartbeat packet is not received within a preset time, the service module determines the fault event of the browsing page. Therefore, the service module monitors the heartbeat packet and determines whether the page is faulty. In the scenario of forcibly closing the browser, the fault event of the browsing page can also be accurately obtained, thereby improving the accuracy of browsing page fault monitoring, and realizing browsing page fault monitoring based on the service module in the browser, without sending a heartbeat packet to the server, thereby reducing the cost of the server.
[0139] Figure 7 is a block diagram of an electronic device 700 for acquiring browsing page faults according to an exemplary embodiment.
[0140] like Figure 7 As shown, the electronic device 700 includes:
[0141] The memory 710 and the processor 720, the bus 730 connecting different components (including the memory 710 and the processor 720), the memory 710 stores a computer program, and when the processor 720 executes the program, the method for obtaining the browsing page fault described in the embodiment of the present disclosure is implemented.
[0142] Bus 730 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.
[0143] The electronic device 700 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by the electronic device 700, including volatile and non-volatile media, removable and non-removable media.
[0144] The memory 710 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 740 and / or cache memory 750. The electronic device 700 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 760 may be used to read and write non-removable, non-volatile magnetic media ( Figure 7 not shown, usually called a "hard drive"). Although Figure 7 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 730 via one or more data medium interfaces. The memory 710 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present disclosure.
[0145] A program / utility 780 having a set (at least one) of program modules 770 may be stored, for example, in the memory 710, such program modules 770 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 770 generally perform the functions and / or methods of the embodiments described in the present disclosure.
[0146] The electronic device 700 may also communicate with one or more external devices 790 (e.g., keyboard, pointing device, display 791, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 700, and / or communicate with any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 792. Furthermore, the electronic device 700 may also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN) and / or public network, such as the Internet) through a network adapter 793. As shown, the network adapter 793 communicates with other modules of the electronic device 700 through a bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0147] The processor 720 executes various functional applications and data processing by running the programs stored in the memory 710 .
[0148] It should be noted that the implementation process and technical principles of the electronic device of this embodiment refer to the aforementioned explanation of the method for obtaining the browsing page fault of the embodiment of the present disclosure, and will not be repeated here.
[0149] The electronic device provided by the embodiment of the present disclosure can execute the method for obtaining browsing page faults as described above, and receive a registration request sent by the browsing process of the browsing page through the service module of the browser, the registration request includes the identifier of the browsing page, and establish a timer for the browsing process according to the registration request. The service module of the browser receives the heartbeat packet periodically sent by the browsing process of the browsing page, and when the heartbeat packet is not received within the preset time, the service module determines the fault event of the browsing page. Therefore, the service module monitors the heartbeat packet and determines whether the page is faulty. For the scenario of forcibly closing the browser, the fault event of the browsing page can also be accurately obtained, thereby improving the accuracy of browsing page fault monitoring, and realizing browsing page fault monitoring based on the service module in the browser, without sending a heartbeat packet to the server, thereby reducing the cost of the service end.
[0150] In order to implement the above embodiments, the present disclosure also proposes a computer-readable storage medium.
[0151] When the instructions in the computer-readable storage medium are executed by the processor, the method for obtaining browsing page faults as described above can be executed.
[0152] In order to implement the above embodiments, the present disclosure further provides a computer program product, including a computer program, which, when executed by a processor, can execute the above-mentioned method for obtaining browsing page faults.
[0153] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0154] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for obtaining browsing page faults, characterized in that: Executed by a service module in a browser, the method includes: receiving a registration request, wherein the registration request is sent by a browsing process of a browsing page, and the registration request includes an identifier of the browsing page; Establishing a timer for the browsing process according to the registration request; Receiving a heartbeat packet, wherein the heartbeat packet is periodically sent by the browsing process to the service module; If the heartbeat packet is not received within a preset time, determining a fault event of the browsing page, wherein the preset time is set to be greater than the sending cycle of the heartbeat packet, and the timer triggers the fault event after the preset time; The registration request includes a category identifier corresponding to the browsing page, and the establishing a timer for the browsing process according to the registration request includes: Determining preset times corresponding to a plurality of browsing processes respectively according to the category identifier; The timer is established for the browsing process according to the preset times respectively corresponding to the multiple browsing processes.
2. The method according to claim 1, characterized in that in, The heartbeat packet includes the identifier of the browsing page. After receiving the heartbeat packet, the method further includes: Determining a timer corresponding to the identifier of the browsing page; The timing time of the timer corresponding to the identifier of the browsing page is updated.
3. The method according to any one of claims 1 to 2, characterized in that: Also includes: Receiving a page exit message sent by a browsing process of the browsing page; The timer corresponding to the browsing process is closed according to the page exit message.
4. The method according to any one of claims 1 to 2, characterized in that: After determining the failure event of the browsing page, the method further includes: Determining a trigger time of the timer; The failure event of the browsing page and the trigger time are sent to the browser, wherein the browser generates and displays page abnormality information according to the failure event of the browsing page and the trigger time.
5. A device for obtaining browsing page faults, characterized in that: Executed by the service module in the browser, including: A first receiving unit is configured to receive a registration request, wherein the registration request is sent by a browsing process of a browsing page, the registration request includes an identifier of the browsing page, and the registration request includes a category identifier corresponding to the browsing page; an establishing unit, configured to execute establishing a timer for the browsing process according to the registration request; A second receiving unit is configured to receive a heartbeat packet, wherein the heartbeat packet is periodically sent by the browsing process to the service module; A first determining unit is configured to determine a fault event of the browsing page when the heartbeat packet is not received within a preset time, wherein the preset time is set to be greater than a sending period of the heartbeat packet, and the timer triggers the fault event after the preset time; The establishing unit is specifically configured as follows: Determining preset times corresponding to a plurality of browsing processes respectively according to the category identifier; The timer is established for the browsing process according to the preset times respectively corresponding to the multiple browsing processes.
6. The device according to claim 5, characterized in that The heartbeat packet includes the identification of the browsing page, and the device further includes: A second determining unit is configured to execute determining a timer corresponding to the identifier of the browsing page; The updating unit is configured to update the timing time of the timer corresponding to the identifier of the browsing page.
7. The device according to any one of claims 5 to 6, characterized in that: Also includes: A third receiving unit is configured to receive a page exit message sent by a browsing process of the browsing page; The closing unit is configured to execute a timer corresponding to closing the browsing process according to the page exit message.
8. The device according to any one of claims 5 to 6, characterized in that: The device also includes: A third determining unit is configured to determine a triggering time of the timer; The sending unit is configured to send the failure event of the browsing page and the trigger time to the browser, wherein the browser generates and displays page exception information according to the failure event of the browsing page and the trigger time.
9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instruction to implement the method for obtaining browsing page faults as described in any one of claims 1-4.
10. A computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method for obtaining browsing page faults as described in any one of claims 1 to 4.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for obtaining browsing page faults according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Webpage state monitoring method based on heartbeat mechanism and related equipment
CN110401580A