Multi-page data processing method and device

By inserting an iframe page into the page to seize the target lock, cross-page communication is achieved, and the problem of repeated push of notifications between different source pages is solved, improving the stability and compatibility of browser notifications.

CN119046558APending Publication Date: 2024-11-29SHANGHAI BILIBILI TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411017800.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

The existing browser notification implementation method has duplicate push problems when communicating between different source pages, and the service stability and compatibility are poor, so it cannot be effectively adapted to the browser version of most users.

Method used

By inserting an iframe page when loading the page, using the iframe page to seize the target lock to achieve cross-page communication, avoiding the restrictions of the same-origin policy, and relying on the services provided by the website service itself for notification push, such as polling or establishing long connections.

Benefits of technology

Cross-page communication between multiple pages that ignore homologous restrictions is achieved, avoiding repeated notification pushes, and improving stability and compatibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119046558A_ABST
    Figure CN119046558A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a multi-page data processing method which comprises the steps that when a first page is loaded and meets a preset condition, a first iframe-me page is inserted into the first page, the first page is any page in web pages, and the first iframe-me page corresponds to the first iframe-me page; the first iframe page is used for preempting a target lock in the web page for the corresponding first page and notifying the corresponding first page to execute a notification task under the condition that the target lock is obtained, and the target lock is used for limiting that only one first page executes the notification task within the same time; under the condition that the first page is loaded, trying to request a target lock for the first page by utilizing the first iframe page; and under the condition that the first iframe page successfully obtains the target lock, utilizing the first iframe page obtaining the target lock to notify the corresponding first page to start executing the notification task. According to the technical scheme, the stability is good, the compatibility is high, and the problem that messages of different source pages are repeatedly pushed can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of network technology, and in particular, to a multi-page data processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] Browser notifications can deliver the latest information to users in real time, such as news updates, social media trends, email reminders, etc., if the user authorizes notification permissions. When a website or application needs to send a notification to a user, they will use the browser's notification API to trigger these notifications.

[0003] Currently, there are two common browser notification implementations:

[0004] 1. Subscribe to the message push service provided by the browser manufacturer:

[0005] Browser manufacturers provide relevant message push services, which developers use through Notification API, Service Worker API, Push API and specific communication protocols between web business servers and message push services. Business servers use the message push services to push message data to users.

[0006] 2. Poll the interface within the page or establish a long connection with the push platform to pull data for message push:

[0007] When the user opens a web page with relevant functions, start http interface polling or establish websock-et long connection communication. Once there is message data returned or updated, call the Notification API to generate a browser notification to display to the user.

[0008] However, the stability of the service of the first implementation method is related to the region, and the subscription service cannot run stably in some regions; the push API it relies on has poor compatibility and cannot effectively adapt to the browser versions of most users. When the website is large in scale and the main scene page uses multiple non-same-origin domain names, the second implementation method simply supports the implementation of preventing repeated push of browser notifications within the same-origin page. It cannot avoid the problem of repeated push of browser notifications when multiple pages from different sources are opened, because the existing direct communication methods between pages are restricted by the same-origin policy. Without special treatment, effective communication cannot be formed between pages from different sources.

[0009] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the invention

[0010] Embodiments of the present application provide a multi-page data processing method, apparatus, computer device, computer-readable storage medium, and computer program product to solve or alleviate one or more of the technical problems raised above.

[0011] One aspect of an embodiment of the present application provides a multi-page data processing method, the method comprising:

[0012] When a first page is loaded and the first page meets a preset condition, a first iframe page is inserted into the first page, wherein the first page is any page in a web page, and the first iframe page is used to seize a target lock in the web page for the corresponding first page, and notify the corresponding first page to perform a notification task when the target lock is obtained, and the target lock is used to limit that only one of the first page performs a notification task at the same time;

[0013] When the first page is loaded, using the first iframe page to attempt to request the target lock for the corresponding first page;

[0014] In the case where the first iframe page successfully obtains the target lock, the first iframe page that obtains the target lock is used to notify the corresponding first page to start executing a notification task.

[0015] Optionally, the method further comprises:

[0016] In the case that the first iframe page fails to obtain the target lock, placing the first page corresponding to the first iframe page that fails to obtain the lock into a page queue to wait for the release of the target lock;

[0017] When the target lock is released, the first iframe page is continued to be used to attempt to request the target lock for the corresponding first page.

[0018] Optionally, after notifying the corresponding first page to start executing a notification task by using the first iframe page that obtains the target lock, the method further includes:

[0019] When the first corresponding page obtains or receives the target notification, obtain the notification data of the client locally, wherein the notification data is used to record the historical data of the notification of the web page being processed;

[0020] determining, according to the notification data, whether the target notification has been processed within a preset time;

[0021] If the target notification has been processed within the preset time, the target notification is discarded.

[0022] Optionally, when the first page is loaded and the first page meets a preset condition, inserting a first iframe page into the first page includes:

[0023] Determine whether the first page supports a message push function;

[0024] In the case where the first page supports a message push function, the first iframe page is inserted into the first page.

[0025] Optionally, the using the first iframe page to attempt to request the target lock as the corresponding first page includes:

[0026] Determining whether the browser supports a first application programming interface, wherein the first application programming interface is used to acquire, hold or release the target lock;

[0027] In the case where the browser supports the first application program interface, using the first iframe page to call the first standard application program interface to try to request the target lock for the corresponding first page;

[0028] When the browser does not support the first application program interface, the first ifra me page is used to call the second application program interface to attempt to request the target lock for the corresponding first page, and the second application program interface is used to obtain, hold or release the target lock through persistent storage of data.

[0029] Optionally, after notifying the corresponding first page to start executing a notification task by using the first iframe page that obtains the target lock, the method further includes:

[0030] Periodically polling the HTTP interface related to the corresponding first page to obtain target notifications, and / or establishing a websocket connection between the corresponding first page and a related push platform to receive target notifications pushed by the push platform;

[0031] When the target notification is acquired or received, the target notification is displayed through the notification mechanism of the web page.

[0032] Optionally, the method further comprises:

[0033] A pop-up window will pop up to indicate that the permission to send invitation notifications has been enabled;

[0034] When the prompt pop-up window receives a consent instruction, requesting notification permission through a request pop-up window;

[0035] When the notification permission is authorized, the notification display of the web page is enabled.

[0036] Another aspect of an embodiment of the present application provides a multi-page data processing device, the device comprising:

[0037] an insertion module, configured to insert a first iframe page into a first page when a first page is loaded and the first page meets a preset condition, wherein the first page is any page in a web page, the first iframe page is configured to seize a target lock in the web page for the corresponding first page, and notify the corresponding first page to perform a notification task when the target lock is obtained, and the target lock is configured to limit that only one of the first page performs a notification task at the same time;

[0038] a request module, configured to, when the first page is loaded, use the first iframe page to attempt to request the target lock for the first page;

[0039] The notification module is used to notify the corresponding first page to start executing the notification task by using the first iframe page that obtains the target lock when the first iframe page successfully obtains the target lock.

[0040] Another aspect of an embodiment of the present application provides a computer device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein: the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described above.

[0041] Another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method described above is implemented.

[0042] Another aspect of an embodiment of the present application provides a computer program product, including a computer program, which implements the method described above when executed by a processor.

[0043] The above technical solution adopted in the embodiment of the present application may have the following advantages:

[0044] By inserting a first iframe page into the first page when the first page is loaded and the first page meets a preset condition, and using the first iframe page to attempt to request a lock for the first page when the first page is loaded, and using the first iframe page to notify the first page to start executing the notification task when the first iframe page successfully obtains the lock, since the same first ifr-ame page is inserted into different pages, the first iframe pages in different pages are of the same origin, and the first iframe pages are not restricted by the same-origin policy. Therefore, by inserting iframe pages into pages of the same origin or different origins to seize the right to execute notifications, cross-page communication between multiple parent pages without regard to same-origin restrictions can be achieved, thereby avoiding repeated push of notifications caused by multiple pages pushing notifications at the same time; at the same time, the specific implementation can rely on the services provided and managed by the website service itself (such as polling or establishing a long connection) to realize the push of notifications, so it has higher stability and better compatibility. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0046] Figure 1 A diagram schematically shows an operating environment of a multi-page data processing method according to Embodiment 1 of the present application;

[0047] Figure 2 A flowchart of a multi-page data processing method according to Embodiment 1 of the present application is schematically shown;

[0048] Figure 3 Schematically shows Figure 2 Flow chart of sub-steps of step S200;

[0049] Figure 4 The schematic diagram shows a principle diagram of a multi-page data processing method according to the first embodiment of the present application;

[0050] Figure 5 The newly added process of the multi-page data processing method according to the first embodiment of the present application is schematically shown;

[0051] Figure 6 Another newly added process of the multi-page data processing method according to the first embodiment of the present application is schematically shown;

[0052] Figure 7 Schematically illustrates another newly added process of the multi-page data processing method according to the first embodiment of the present application;

[0053] Figure 8 Schematically illustrates another newly added process of the multi-page data processing method according to the first embodiment of the present application;

[0054] Fig. 9 A block diagram schematically shows a multi-page data processing device according to the second embodiment of the present application; and

[0055] Fig.10 The hardware architecture diagram of the computer device according to the third embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0056] In order to make the purpose, technical solutions 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 intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0057] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0058] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.

[0059] First, the following terms are explained:

[0060] Browser notification: refers to the system notification generated by calling the browser's Notification API.

[0061] Cross-page: non-same-origin pages that only have different main domain names (host).

[0062] Cross-page communication: communication between non-same-origin pages with different primary domain names (host).

[0063] Same origin: Two URLs have the same origin if their protocol, port (if specified), and primary domain name are the same.

[0064] Non-same-origin: If the protocol, port (if specified) and primary domain name of two URLs are different, then the two URLs are of non-same-origin.

[0065] Same-origin policy: is an important security policy that is used to limit how a document from one source or a script it loads can interact with resources from another source. It can help block malicious documents and reduce possible attack vectors. For example, it can prevent malicious websites on the Internet from running JS scripts in browsers, reading data from third-party webmail services (users are logged in) or company intranets (protected by no public IP addresses and not directly accessible by attackers), and forwarding this data to attackers.

[0066] Iframe page: The HTML element tag iframe can be used to embed another page into the current page. The embedded page is called an iframe page.

[0067] Websocket: is a network transmission protocol. The client initiates a connection request to the server to establish a persistent long connection communication, allowing the server to actively push data to the client.

[0068] http: HyperText Transfer Protocol, the client initiates a connection request to the server, and the connection is disconnected when a response result is returned or the request times out.

[0069] Web locks API: Allows scripts running in a tab or worker to asynchronously acquire locks, hold the lock while performing work, and optionally release the lock when the work is complete. While a script holds a lock, no other script executing in the same origin can acquire the same lock, which allows web applications running in multiple tabs or workers to coordinate work and resource use.

[0070] Local Storage API: Allows web applications to store key-value data on the user's browser, which is retained even after the browser is closed until explicitly deleted.

[0071] Secondly, in order to facilitate those skilled in the art to understand the technical solutions provided in the embodiments of the present application, the relevant technologies are described below:

[0072] In the related technologies, the service stability of the method of subscribing to the message push service provided by the browser manufacturer is related to the region. The subscription service cannot run stably in some areas, and the push API it relies on has poor compatibility and cannot effectively adapt to the browser versions of most users. The method of pulling data for message push through the polling interface within the page or establishing a long connection communication with the push platform, when the website is large in scale and the main scene page uses multiple non-homologous domain names, simply supports the method of preventing repeated push of browser notifications within the same-source page, and cannot avoid the problem of repeated push of browser notifications when multiple pages from different sources are opened.

[0073] To this end, the embodiment of the present application provides a multi-page data processing technical solution. In this technical solution, the website service provider can rely on the services provided and managed by the website service provider itself, so it has good stability and high compatibility, and can avoid the problem of repeated message push of different source pages, reducing the impact of the same-source policy. See below for details.

[0074] Finally, for ease of understanding, an exemplary operating environment is provided below.

[0075] like Figure 1 As shown, the operating environment diagram includes a service platform 2, a network 4, and a client 6, wherein:

[0076] The service platform 2 may be composed of a single or multiple computing devices. The multiple computing devices may include virtualized computing instances. Virtualized computing instances may include virtual machines, such as simulations of computer systems, operating systems, servers, etc. The computing device may load a virtual machine based on a virtual image and / or other data defining specific software (e.g., operating system, dedicated application, server) for simulation. As the demand for different types of processing services changes, different virtual machines may be loaded and / or terminated on one or more computing devices. A hypervisor may be implemented to manage the use of different virtual machines on the same computing device.

[0077] The service platform 2 may be configured to communicate with the client 6 or the like via a network 4. The network 4 includes various network devices, such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and / or the like. The network 4 may include physical links, such as coaxial cable links, twisted pair cable links, optical fiber links, combinations thereof, and the like, or wireless links, such as cellular links, satellite links, Wi-Fi links, and the like.

[0078] The service platform 2 can provide storage, reading, writing, querying, deleting and other services, such as providing message push services for clients.

[0079] Client 6 can be a Windows, Android TM) or iOS operating systems, such as smart phones, tablet devices, laptop computers, virtual reality devices, gaming devices, set-top boxes, car terminals, and smart TVs. Based on the above operating systems, various applications can be run, such as running web pages.

[0080] The client 6 can provide / configure a user access page for reading data of the service platform 2 through a running web page.

[0081] It should be noted that the above devices are exemplary, and the number and type of devices are adjustable in different scenarios or according to different needs.

[0082] The following describes the technical solution of the present application through multiple embodiments, taking the client as the execution subject. It should be noted that these embodiments can be implemented in a variety of different forms and should not be interpreted as being limited to the embodiments described here.

[0083] Embodiment 1

[0084] Figure 2 The flowchart of the multi-page data processing method according to the first embodiment of the present application is schematically shown.

[0085] like Figure 2 As shown, the multi-page data processing method may include steps S200 to S204, wherein:

[0086] Step S200, when the first page is loaded and the first page meets the preset conditions, insert a first iframe page into the first page, wherein the first page is any page in the web page, and the first iframe page is used to seize the target lock in the web page for the corresponding first page, and notify the corresponding first page to execute the notification task when the target lock is obtained, and the target lock is used to limit only one first page to execute the notification task at the same time.

[0087] Step S202: When the first page is loaded, the first iframe page is used to attempt to request a target lock for the corresponding first page.

[0088] Step S204, when the first iframe page successfully obtains the target lock, the first iframe page that obtains the target lock is used to notify the corresponding first page to start executing the notification task.

[0089] The multi-page data processing method provided in this embodiment inserts a first iframe page into the first page when the first page is loaded and the first page meets the preset conditions. When the first page is loaded, the first iframe page is used to try to request a lock for the first page. When the first iframe page successfully obtains the lock, the first iframe page is used to notify the first page to start executing the notification task. Since the same first iframe page is inserted into different pages, the first ifra-me pages in different pages are of the same origin, and the first iframe pages are not restricted by the same-origin policy. Therefore, by inserting iframe pages into pages of the same origin or different origins to seize the right to execute notifications, cross-page communication between multiple parent pages without regard to same-origin restrictions can be achieved, thereby avoiding repeated push of notifications caused by multiple pages pushing notifications at the same time. At the same time, the specific implementation can rely on the services provided and managed by the website service itself (such as polling or establishing a long connection) to realize the push of notifications, so it has higher stability and better compatibility.

[0090] The following combination Figure 2 , each step in steps S200 to S204 and other optional steps are described in detail.

[0091] Step S200 , when the first page is loaded and the first page meets the preset conditions, a first iframe page is inserted into the first page, wherein the first page is any page in the web page, and the first iframe page is used to seize the target lock in the web page for the corresponding first page, and notify the corresponding first page to execute the notification task when the target lock is obtained, and the target lock is used to limit only one first page to execute the notification task at the same time.

[0092] The preset condition can be set according to actual needs, so that the first iframe page is inserted into at least part of the web page. In particular, the preset condition can be empty, in which case the first iframe page is inserted into all pages in the web page. It can be understood that since different pages are inserted into the first iframe page with the same address, the first iframe pages between different pages are of the same origin, and are not restricted by the same-origin policy.

[0093] The target lock is used to coordinate the execution of browser notification rights between multiple pages of the browser (web), ensuring that at any time, only one page can obtain and execute the permission to send notifications, thereby avoiding multiple pages sending notifications at the same time and causing repeated push notifications. In addition, the target lock can be released after the page executes the notification.

[0094] The first frame page can be implemented by SDK, wherein the SDK is used to implement logic such as the corresponding first page grabbing the target lock in the web page, and notifying the corresponding first page to execute the notification task when the target lock is obtained.

[0095] In the case where the first page is inserted into the first iframe page, the first page is the parent page of the corresponding first iframe page, and the first iframe page is the child page of the corresponding first page.

[0096] In an optional embodiment, if Figure 3 As shown, step 200 may further include steps S500 to S502:

[0097] Step S500, determining whether the first page supports a message push function.

[0098] Step S502: When the first page supports a message push function, insert a first iframe page into the first page.

[0099] That is, the preset condition may include that the first page supports the message push function.

[0100] The client can determine whether the first page supports the message push function by checking whether the first page has a corresponding browser notification interface, wherein the browser notification interface is, for example, the Notification API. For example, if the first page supports the Notification API, it is determined that the first page supports the message push function; if the first page does not support the Notification API, it is determined that the first page does not support the message push function. If the first page supports the message push function, the first iframe page is inserted into the first page; if the first page does not support the message push function, the first iframe page is not inserted into the first page.

[0101] Since pages that do not support the message push function do not need to seize the right to execute notifications through an iframe page, in the above optional embodiment, by determining whether the first page supports the message push function, and inserting the first iframe page into the first page if the first page supports the message push function, the targetedness of inserting the iframe page and the accuracy of the implementation of the solution can be improved.

[0102] Step S202 , when the first page is loaded, the first iframe page is used to try to request a target lock for the corresponding first page.

[0103] In an optional embodiment, using the first iframe page to attempt to request a target lock for the corresponding first page may include: determining whether the browser supports a first application interface, the first application interface is used to obtain, hold or release the target lock, and when the browser supports the first application interface, using the first iframe page to call the first application interface to attempt to request a target lock for the corresponding first page; when the browser does not support the first application interface, using the first iframe page to call the second application interface to attempt to request a target lock for the corresponding first page, the second application interface is used to obtain, hold or release the target lock through persistent storage of data.

[0104] The first application program interface is, for example, a web locks API, and the second application program interface is, for example, a localstorage API.

[0105] Please refer to Figure 4 , which is a principle example diagram of the multi-page data processing method; as shown in the figure, there are multiple pages of the same origin and pages of different origins in the web page. When the browser supports the web locks api, after the parent page is loaded, each inserted iframe page uses the inserted iframe page to call the web locks api to try to seize the right to execute the notification task for the corresponding parent page; when the browser does not support the web locks api, it is downgraded to use the localstorage api to implement the same logic.

[0106] Step S204 When the first iframe page successfully obtains the target lock, the first iframe page that obtains the target lock is used to notify the corresponding first page to start executing the notification task.

[0107] For example Figure 4 As shown, assuming that the third iframe page in the figure: www.XXXX.com / leader (the first iframe page) successfully obtains the lock, the third iframe page: www.XXXX.com / leader communicates with the corresponding parent page search.XXXX.com (the first page) to notify the corresponding parent page that the notification task can be performed, where XXXX refers to a specific string.

[0108] In an optional embodiment, the first iframe page is also used to release the target lock when the corresponding first page completes the notification task, such as Figure 5 As shown, the method may further include steps S300 to S302:

[0109] Step S300: When the first iframe page fails to obtain the target lock, the first page corresponding to the first iframe page that fails to obtain the lock is placed in a page queue to wait for the release of the target lock.

[0110] Step S302: When the target lock is released, continue to use the first iframe page as the corresponding first page to try to request the target lock.

[0111] The page queue can be set according to actual business needs. For example, a higher priority can be set for some pages, so that pages with higher priority can more easily obtain the target lock. The page that obtained the target lock last time can continue to seize the next round of target locks, or it can be excluded. The number of consecutive target locks for each page can also be limited. The specific settings can be based on business needs.

[0112] In the above optional embodiment, when the first iframe page fails to obtain the target lock, the first page corresponding to the first iframe page that has not obtained the target lock is placed in the page queue to wait for the release of the target lock. When the target lock is released, the first iframe page is continued to be used to try to request the target lock for the first page. This ensures that only one page executes the notification at a time, avoiding repeated push of notifications caused by multiple pages pushing notifications at the same time, thereby improving the user experience.

[0113] In an optional embodiment, if Figure 6 As shown, after step S204, that is, after the first iframe page that obtains the target lock notifies the corresponding first page to start executing the notification task, the method may further include steps S400 to S404:

[0114] Step S400, when the corresponding first page obtains or receives the target notification, obtain the notification data of the client locally, wherein the notification data is used to record the historical data of the notification of the web page being processed.

[0115] Step S402: determining whether the target notification has been processed within a preset time according to the notification data.

[0116] Step S404: if the target notification has been processed within a preset time, discard the target notification.

[0117] That is, the client can record the history of notification processing to form notification data. When the first page obtains or receives the target notification, the subject and content of the target notification are compared with the historical data in the notification data. If the comparison result shows that the target notification has been processed within the preset time (such as 1 day), the target notification is discarded; if the comparison result shows that the target notification has not been processed within the preset time, the target notification is displayed on the client using the browser notification mechanism.

[0118] In the above optional embodiment, by obtaining or receiving the target notification on the first page, the local notification data of the client is obtained, and whether the target notification has been processed within the preset time is determined according to the local notification data of the client. If the target notification has been processed within the preset time, the target notification is discarded, which can ensure that notifications between multiple pages will not be pushed repeatedly, thereby improving the user experience; at the same time, by pushing notifications by comparison with local notification data, notifications that should have been pushed by other pages but were not actually pushed can also be pushed to the client, thereby increasing the probability of push messages reaching users.

[0119] In an optional embodiment, if Figure 7 As shown, after step S204, that is, after the first iframe page that obtains the target lock notifies the corresponding first page to start executing the notification task, the method may further include steps S600 to S602:

[0120] Step S600: regularly polling the HTTP interface related to the corresponding first page to obtain the target notification, and / or, establishing a websocket connection between the corresponding first page and the related push platform to receive the target notification pushed by the push platform.

[0121] Step S602: When a target notification is acquired or received, the target notification is displayed through a notification mechanism of a web page.

[0122] The HTTP interface related to the first page corresponding to the first iframe page that obtains the target lock can be various dynamic, event, video, live broadcast and other interfaces. By periodically polling the relevant HTTP interface, notifications related to the interface can be obtained. Establishing a websocket connection between the first page corresponding to the first iframe page that obtains the target lock and the relevant push platform is to establish a long connection with the relevant push platform. When the relevant push platform has a target notification, it is sent to the client through the long connection.

[0123] In the above optional embodiments, the target notification is obtained by periodically polling the HTTP interface related to the first page corresponding to the first iframe page for obtaining the target lock, and / or, a websocket connection is established between the corresponding first page and the relevant push platform to receive the target notification pushed by the push platform. When the target notification is obtained or received, the target notification is displayed through the notification mechanism of the web page, and the page-related notification can be obtained and displayed to the client.

[0124] In an optional embodiment, if Figure 8 As shown, the method may further include steps S700 to S704:

[0125] Step S700: Send a pop-up window to prompt that the invitation notification permission is enabled.

[0126] Step S702: When the prompt pop-up window receives the consent instruction, request notification permission through a request pop-up window.

[0127] Step S704: if the notification permission is authorized, enable notification display on the web page.

[0128] Specifically, the client can send a prompt pop-up window to enable the invitation notification permission according to the configured sending frequency. If the user agrees to the prompt pop-up window, the browser's notification permission is requested through a preset request pop-up window; if the user authorizes the notification permission, the notification display on the web page is enabled.

[0129] In the above optional embodiment, a prompt pop-up window is sent to invite notification permission to be enabled. When the prompt pop-up window receives the consent instruction, the notification permission is requested through a request pop-up window. When the notification permission is authorized, the notification display of the web page is enabled. The browser notification capability can be enabled with user authorization, thereby ensuring that the browser notification meets the user's needs, improving the user experience, and facilitating the execution of the browser notification.

[0130] Embodiment 2

[0131] Fig. 9 The block diagram of a multi-page data processing device 800 according to the second embodiment of the present application is schematically shown. The device can be divided into one or more program modules, one or more program modules are stored in a storage medium, and are executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Fig. 9 As shown, the apparatus 800 may include: an insert module 810, a request module 820 and a notification module 830, wherein:

[0132] The inserting module 810 is used to insert a first iframe page into the first page when the first page is loaded and the first page meets a preset condition, wherein the first page is any page in the web page, the first iframe page is used to seize a target lock in the web page for the corresponding first page, and notify the corresponding first page to perform a notification task when the target lock is obtained, and the target lock is used to limit that only one of the first page performs a notification task at the same time;

[0133] A request module 820, configured to, when the first page is loaded, attempt to request the target lock for the first page by using the first iframe page;

[0134] The notification module 830 is used to notify the corresponding first page to start executing the notification task by using the first iframe page that obtains the target lock when the first iframe page successfully obtains the target lock.

[0135] In an optional embodiment, the device 800 is further used for:

[0136] In the case that the first iframe page fails to obtain the target lock, placing the first page corresponding to the first iframe page that fails to obtain the target lock into a page queue to wait for the release of the target lock;

[0137] When the target lock is released, the first iframe page is continued to be used to attempt to request the target lock for the corresponding first page.

[0138] In an optional embodiment, the device 800 is further used for:

[0139] When the first corresponding page obtains or receives the target notification, obtain the notification data of the client locally, wherein the notification data is used to record the historical data of the notification of the web page being processed;

[0140] determining, according to the notification data, whether the target notification has been processed within a preset time;

[0141] If the target notification has been processed within the preset time, the target notification is discarded.

[0142] In an optional embodiment, the insertion module 810 is further configured to:

[0143] Determine whether the first page supports a message push function;

[0144] In the case where the first page supports a message push function, the first iframe page is inserted into the first page.

[0145] In an optional embodiment, the request module 820 is further configured to:

[0146] Determining whether the browser supports a first application programming interface, wherein the first application programming interface is used to acquire, hold or release the target lock;

[0147] In the case where the browser supports the first application program interface, using the first iframe page to call the first standard application program interface to try to request the target lock for the corresponding first page;

[0148] When the browser does not support the first application program interface, the first ifra me page is used to call the second application program interface to attempt to request the target lock for the corresponding first page, and the second application program interface is used to obtain, hold or release the target lock through persistent storage of data.

[0149] In an optional embodiment, the device 800 is further used for:

[0150] Periodically polling the HTTP interface related to the corresponding first page to obtain target notifications, and / or establishing a websocket connection between the corresponding first page and a related push platform to receive target notifications pushed by the push platform;

[0151] When the target notification is acquired or received, the target notification is displayed through the notification mechanism of the web page.

[0152] In an optional embodiment, the device 800 is further used for:

[0153] A pop-up window will pop up to indicate that the permission to send invitation notifications has been enabled;

[0154] When the prompt pop-up window receives a consent instruction, requesting notification permission through a request pop-up window;

[0155] When the notification permission is authorized, the notification display of the web page is enabled.

[0156] Embodiment 3

[0157] Fig.10The schematic diagram of the hardware architecture of a computer device 10000 suitable for implementing a multi-page data processing method according to the third embodiment of the present application is schematically shown. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle-mounted terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Fig.10 As shown, the computer device 10000 includes but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them:

[0158] The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (such as an SD or DX memory), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 10010 may be an internal storage module of the computer device 10000, such as a hard disk or a memory of the computer device 10000. In other embodiments, the memory 10010 may also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 10010 may also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed in the computer device 10000, such as program codes of the multi-page data processing method, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or will be output.

[0159] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.

[0160] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.

[0161] It should be pointed out that Fig.10 Only a computer device having components 10010 - 10030 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.

[0162] In this embodiment, the multi-page data processing method stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of the present application.

[0163] Embodiment 4

[0164] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the multi-page data processing method in the embodiment are implemented.

[0165] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEP ROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the computer-readable storage medium can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store the operating system and various application software installed on the computer device, such as the program code of the multi-page data processing method in the embodiment, etc. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or are to be output.

[0166] Embodiment 5

[0167] An embodiment of the present application also provides a computer program product, including a computer program, which implements the method in the above embodiment when executed by a processor.

[0168] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by general-purpose computer devices, they can be concentrated on a single computer device, or distributed on a network composed of multiple computer devices, optionally, they can be implemented by executable program codes of computer devices, so that they can be stored in a storage device and executed by the computer device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0169] It should be noted that the above are only preferred embodiments of the present application, and the patent protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A multi-page data processing method, It is characterized in that The method comprises: When a first page is loaded and the first page meets a preset condition, a first iframe page is inserted into the first page, wherein the first page is any page in a web page, and the first iframe page is used to seize a target lock in the web page for the corresponding first page, and notify the corresponding first page to perform a notification task when the target lock is obtained, and the target lock is used to limit that only one of the first page performs a notification task at the same time; When the first page is loaded, using the first iframe page to attempt to request the target lock for the corresponding first page; In the case where the first iframe page successfully obtains the target lock, the first iframe page that obtains the target lock is used to notify the corresponding first page to start executing a notification task.

2. The method according to claim 1, It is characterized in that The first iframe page is also used to release the target lock when the corresponding first page completes the notification task. The method further includes: In the case that the first iframe page fails to obtain the target lock, placing the first page corresponding to the first iframe page that fails to obtain the lock into a page queue to wait for the release of the target lock; When the target lock is released, the first iframe page is continued to be used to attempt to request the target lock for the corresponding first page.

3. The method according to claim 1, It is characterized in that After notifying the corresponding first page by using the first iframe page that obtains the target lock to start executing the notification task, the method further includes: When the first corresponding page obtains or receives the target notification, obtain the notification data of the client locally, wherein the notification data is used to record the historical data of the notification of the web page being processed; determining, according to the notification data, whether the target notification has been processed within a preset time; If the target notification has been processed within the preset time, the target notification is discarded.

4. The method according to claim 1, It is characterized in that The method of inserting a first iframe page into the first page when the first page is loaded and the first page meets a preset condition includes: Determine whether the first page supports a message push function; In the case where the first page supports a message push function, the first iframe page is inserted into the first page.

5. The method according to claim 1, It is characterized in that The using the first iframe page to attempt to request the target lock for the corresponding first page includes: Determining whether the browser supports a first application programming interface, wherein the first application programming interface is used to acquire, hold or release the target lock; In the case where the browser supports the first application program interface, using the first iframe page to call the first standard application program interface to try to request the target lock for the corresponding first page; When the browser does not support the first application program interface, the first ifra me page is used to call the second application program interface to attempt to request the target lock for the corresponding first page, and the second application program interface is used to obtain, hold or release the target lock through persistent storage of data.

6. The method according to claim 1, It is characterized in that After notifying the corresponding first page by using the first iframe page that obtains the target lock to start executing the notification task, the method further includes: Periodically polling the HTTP interface related to the corresponding first page to obtain target notifications, and / or establishing a websocket connection between the corresponding first page and a related push platform to receive target notifications pushed by the push platform; When the target notification is acquired or received, the target notification is displayed through the notification mechanism of the web page.

7. The method according to any one of claims 1 to 6, It is characterized in that The method further comprises: A pop-up window will pop up to indicate that the permission to send invitation notifications has been enabled; When the prompt pop-up window receives a consent instruction, requesting notification permission through a request pop-up window; When the notification permission is authorized, the notification display of the web page is enabled.

8. A multi-page data processing device, It is characterized in that The device comprises: an insertion module, configured to insert a first iframe page into a first page when a first page is loaded and the first page meets a preset condition, wherein the first page is any page in a web page, the first iframe page is configured to seize a target lock in the web page for the corresponding first page, and notify the corresponding first page to perform a notification task when the target lock is obtained, and the target lock is configured to limit that only one of the first page performs a notification task at the same time; a request module, configured to, when the first page is loaded, use the first iframe page to attempt to request the target lock for the first page; The notification module is used to notify the corresponding first page to start executing the notification task by using the first iframe page that obtains the target lock when the first iframe page successfully obtains the target lock.

9. A computer device, It is characterized in that include: at least one processor; and a memory communicatively connected to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.

11. A computer program product comprising a computer program, It is 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

  • Iframe-based page loading method and system

    CN107818171A

  • Method for pushing notifications, electronic equipment and storage medium

    CN114584650A

  • Method and system for dragging iframe element in webpage

    CN114675770A

  • Page construction method and device based on iframe

    CN116382678A

  • Cross-domain communications between browser windows

    US20150248723A1