Webpage loading processing method and device, electronic equipment and storage medium
By generating an array of target web pages and using independent threads to detect and delete repeatedly loaded iframe pages, the problem of repeated loading of iframe pages is solved, web page loading efficiency and performance are improved, and user experience is improved.
Patent Information
- Application Number
- CN202410739415.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-10
AI Technical Summary
In web pages, repeated loading of iframe pages leads to increased page loading time, reduced performance, and may even cause page crashes, reducing user experience.
By generating a target web page array based on the iframe page level information and sorting rules in the target web page, independent threads are used to detect and delete repeatedly loaded iframe pages, and only the highest ranked pages are retained to avoid repeated loading of resources.
It improves web page loading efficiency and performance, improves user experience, reduces the occupation of main thread resources, and optimizes overall process processing efficiency.
Smart Images

Figure CN118626740A
Abstract
Description
Background Art
[0002] At present, with the continuous progress and development of Internet technology, web pages, as the main carrier of information dissemination and interaction, are also becoming more and more functional and complex. Among them, the content of other web pages is seamlessly introduced into one web page to achieve information integration and display.
[0003] However, when the iframe page of system A nests the iframe pages of system B and system C, and the page of system B nests the iframe page of system A, the information of the iframe page will be loaded repeatedly. This repeated loading will increase the loading time of the page, reduce the performance of the page, and may even cause the page to crash, reducing the user experience. Summary of the invention
[0004] The embodiments of the present invention provide a web page loading processing method, device, electronic device and storage medium, which are used to improve the loading efficiency of web pages.
[0005] In a first aspect, an embodiment of the present invention provides a web page loading processing method, the method comprising:
[0006] According to the hierarchical information and sorting rules of each iframe page included in the target webpage, a target webpage array is obtained; the target webpage array includes sorting indication information and uniform resource locator URL information corresponding to each iframe page;
[0007] Perform repeated loading detection on the target web page array based on an independent thread to obtain a detection result;
[0008] When it is determined that the detection result indicates that the target web page array includes multiple iframe pages with the same URL information, deleting each second iframe page among the multiple iframe pages except for the first iframe page with the highest ranking indicated by the ranking indication information;
[0009] A request to load any of the second iframe pages is received, and any of the second iframe pages is loaded based on resources of the first iframe page.
[0010] In a possible implementation, obtaining a target web page array according to the hierarchical information and sorting rules of each iframe page included in the target web page includes:
[0011] Sort the iframe pages according to the hierarchical information and sorting rules of the iframe pages included in the target webpage, and obtain sorting indication information of the iframe pages;
[0012] According to the sorting indication information corresponding to each iframe page, an array of target web pages is obtained.
[0013] In a possible implementation, sorting the iframe pages according to the hierarchical information and sorting rules of the iframe pages included in the target webpage to obtain the sorting indication information of the iframe pages includes:
[0014] According to the hierarchical information of each iframe page included in the target webpage, a first sorting operation is performed on each iframe page from high to low to obtain first sorting information of each iframe page;
[0015] Determine multiple sorting sets with the same first sorting information of the iframe pages, and perform a second sorting operation on the iframe pages in each sorting set based on the business importance corresponding to the iframe pages in each sorting set to obtain second sorting information of the iframe pages in each sorting set;
[0016] Based on the obtained first sorting information and second sorting information of each iframe page, sorting indication information of each iframe page is obtained.
[0017] In a possible implementation, the method further includes:
[0018] After receiving the new URL information corresponding to the new iframe page, determining whether the new URL information exists in the target web page array;
[0019] If the target web page array does not contain the new URL information, determining the sorting indication information of the new iframe page based on the hierarchical information of the new iframe page;
[0020] Based on the sort indication information of the new iframe page, the new iframe page is added to the target web page array to obtain an updated target web page array.
[0021] In a possible implementation manner, deleting each second iframe page among the multiple iframe pages except for the first iframe page with the highest ranking indicated by the ranking indication information includes:
[0022] Determine the parent page of each second iframe page;
[0023] In the information of each parent page, delete the corresponding information of the second iframe page.
[0024] In a possible implementation, the independent thread is ShareWorker; and the ShareWorker is used to provide relay communication for the iframe page of cross-domain communication.
[0025] In a second aspect, an embodiment of the present invention provides a webpage loading processing device, the device comprising:
[0026] A first obtaining unit is used to obtain a target web page array according to the hierarchical information and sorting rules of each iframe page included in the target web page; the target web page array includes sorting indication information and uniform resource locator URL information corresponding to each iframe page;
[0027] A second obtaining unit is used to perform repeated loading detection on the target web page array based on an independent thread to obtain a detection result;
[0028] a processing unit, configured to, when it is determined that the detection result indicates that the target web page array includes multiple iframe pages with the same URL information, delete each second iframe page among the multiple iframe pages except for the first iframe page with the highest ranking indicated by the ranking indication information;
[0029] A loading unit is used to receive a request to load any of the second iframe pages, and load any of the second iframe pages based on the resources of the first iframe page.
[0030] In a possible implementation manner, the first obtaining unit is specifically configured to:
[0031] Sort the iframe pages according to the hierarchical information and sorting rules of the iframe pages included in the target webpage, and obtain sorting indication information of the iframe pages;
[0032] According to the sorting indication information corresponding to each iframe page, an array of target web pages is obtained.
[0033] In a possible implementation manner, the first obtaining unit is specifically configured to:
[0034] According to the hierarchical information of each iframe page included in the target webpage, a first sorting operation is performed on each iframe page from high to low to obtain first sorting information of each iframe page;
[0035] Determine multiple sorting sets with the same first sorting information of the iframe pages, and perform a second sorting operation on the iframe pages in each sorting set based on the business importance corresponding to the iframe pages in each sorting set to obtain second sorting information of the iframe pages in each sorting set;
[0036] Based on the obtained first sorting information and second sorting information of each iframe page, sorting indication information of each iframe page is obtained.
[0037] In a possible implementation manner, the device further includes an updating unit, configured to:
[0038] After receiving the new URL information corresponding to the new iframe page, determining whether the new URL information exists in the target web page array;
[0039] If the target web page array does not contain the new URL information, determining the sorting indication information of the new iframe page based on the hierarchical information of the new iframe page;
[0040] Based on the sort indication information of the new iframe page, the new iframe page is added to the target web page array to obtain an updated target web page array.
[0041] In a possible implementation manner, the processing unit is specifically configured to:
[0042] Determine a parent page of each second iframe page among the multiple iframe pages except the first iframe page;
[0043] In the information of each parent page, delete the corresponding information of the second iframe page.
[0044] In a possible implementation, the independent thread is ShareWorker; and the ShareWorker is used to provide relay communication for the iframe page of cross-domain communication.
[0045] In a third aspect, an embodiment of the present invention provides an electronic 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 so that the at least one processor can execute any method provided in the embodiment of the first aspect of the present invention.
[0046] In a fourth aspect, an embodiment of the present invention provides a computer storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is used to enable a computer to execute any method provided by the embodiment of the first aspect of the present invention.
[0047] In a fifth aspect, an embodiment of the present invention provides a computer program product, comprising: a computer program code, when the computer program code is run on a computer, the computer executes any one of the methods provided in the embodiment of the first aspect.
[0048] The beneficial effects of the present invention are as follows:
[0049] In an embodiment of the present invention, a target web page array can be obtained according to the hierarchical information and sorting rules of each iframe page included in the target web page; wherein the target web page array includes sorting indication information and uniform resource locator URL information corresponding to each iframe page. In other words, the relationship between the iframe pages included in the target web page is embodied in the form of an array, so that when repeated loading detection is performed based on the target web page array in the future, the repeatedly loaded iframe page can be quickly located based on the URL information of each iframe page in the target web page array, thereby improving the processing efficiency of the overall process. Then, repeated loading detection can be performed on the target web page array based on an independent thread to obtain a detection result. Since repeated loading detection is performed on the target web page array based on an independent thread, the resource occupation of the main thread is reduced, thereby reducing the impact on the web page loading business, and to a certain extent, improving the loading efficiency of the web page loading.
[0050] Further, when it is determined that the detection result indicates that the target web page array includes multiple iframe pages with the same URL information, delete all second iframe pages except the first iframe page with the highest ranking indicated by the sorting indication information, and receive a request to load any second iframe page, and load any second iframe page based on the resources of the first iframe page. It can be seen that by deleting the information of the iframe page with a low ranking indicated by the sorting indication information, the repeated loading of the information resources of the iframe page is avoided, thereby improving the loading efficiency of the target web page and the performance of the target web page, thereby improving the user experience.
[0051] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments of the present invention are briefly introduced below. Obviously, the drawings introduced below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0053] Figure 1 A schematic diagram of an application scenario in an embodiment of the present invention;
[0054] Figure 2 A schematic diagram of a flow chart of a web page loading processing method in an embodiment of the present invention;
[0055] Figure 3 A schematic diagram of a process for determining a target web page array in an embodiment of the present invention;
[0056] Figure 4 A schematic diagram of a web page loading processing system according to an embodiment of the present invention;
[0057] Figure 5 A schematic diagram of the structure of a web page loading processing device according to an embodiment of the present invention;
[0058] Figure 6 The figure is a schematic diagram of a hardware structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical scheme and advantages of the present invention clearer, the technical scheme in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only a part of the embodiment of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. In the absence of conflict, the embodiments in the present invention and the features in the embodiments can be combined with each other arbitrarily. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.
[0060] The term "comprising" and any variations thereof in the specification and claims of the present invention are intended to cover non-exclusive protection. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.
[0061] In the embodiments of the present invention, one or more, "many" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or plural.
[0062] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, which includes various details of the embodiments of the present invention to facilitate understanding, and they should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present invention. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description. It should be noted that in the embodiments of the present invention, certain software, components, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present invention, but it does not mean that the applicant has or will necessarily use the solution.
[0063] In the technical solution of the present invention, the collection, dissemination, and use of data are in compliance with the requirements of relevant national laws and regulations.
[0064] As mentioned above, in the related art, there is a situation in which information resources of the iframe page are repeatedly loaded. This repeated loading will increase the loading time of the page, reduce the performance of the page, and may even cause the page to crash, thereby reducing the user experience.
[0065] In view of this, an embodiment of the present invention provides a web page loading processing method, through which a target web page array can be obtained according to the hierarchical information and sorting rules of each iframe page included in the target web page; wherein the target web page array includes sorting indication information and uniform resource locator URL information corresponding to each iframe page. In other words, the relationship between the iframe pages included in the target web page is embodied in the form of an array, so that when repeated loading detection is performed based on the target web page array in the future, the repeatedly loaded iframe page can be quickly located based on the URL information of each iframe page in the target web page array, thereby improving the processing efficiency of the overall process. Then, repeated loading detection can be performed on the target web page array based on an independent thread to obtain a detection result. Since repeated loading detection is performed on the target web page array based on an independent thread, the resource occupation of the main thread is reduced, thereby reducing the impact on the web page loading business, and to a certain extent, improving the loading efficiency of the web page loading.
[0066] Further, when it is determined that the detection result indicates that the target web page array includes multiple iframe pages with the same URL information, the information of each second iframe page except the first iframe page with the highest ranking indicated by the sorting indication information is deleted from the multiple iframe pages, and the information requesting to load any second iframe page is received, and any second iframe page is loaded based on the resources of the first iframe page. It can be seen that by deleting the information of the iframe page with a low ranking indicated by the sorting indication information, the repeated loading of the information resources of the iframe page is avoided, thereby improving the loading efficiency of the target web page and the performance of the target web page, thereby improving the user experience.
[0067] After introducing the design concept of the embodiment of the present invention, the following briefly introduces the application scenarios to which the technical solution of the embodiment of the present invention can be applied. It should be noted that the application scenarios introduced below are only used to illustrate the embodiment of the present invention and are not limited. In the specific implementation process, the technical solution provided by the embodiment of the present invention can be flexibly applied according to actual needs.
[0068] The solution provided by the embodiment of the present invention can be applied to any business scenario in which web page loading processing is performed.
[0069] See also Figure 1 As shown, a schematic diagram of a scenario provided by an embodiment of the present invention may include multiple terminal devices 101 and electronic devices 102. Among them, terminal devices 101-1, terminal devices 101-2, ..., terminal devices 101-n can be used by different users, and n is a positive integer.
[0070] In an embodiment of the present invention, when a user needs to enable a certain function, the function can be triggered on the service platform set on the corresponding terminal device 101, and then the terminal device 101 can send a display request to the electronic device 102, so that the electronic device 102 can determine the corresponding target web page according to the display request, and obtain the target web page array according to the hierarchical information and sorting rules of each iframe page included in the target web page. Then, the target web page array can be repeatedly loaded and detected based on an independent thread to obtain a detection result. When it is determined that the target web page array indicated by the detection result includes the URL information B of the iframe page B that is the same as the uniform resource locator (URL, uniform resource location) information A of the iframe page A in the display request, the information of the first iframe page (for example, iframe page B) with the highest ranking indicated by the sorting indication information in the iframe page A and the iframe page B is retained to load the resources of the iframe page B, thereby realizing the loading of the target web page. It should be noted that the iframe page in the embodiment of the present invention can be understood as the page corresponding to the iframe tag.
[0071] In the embodiment of the present invention, the terminal device 101 may be, for example, a mobile phone, a tablet computer (PAD), a personal computer (PC), a smart TV, a smart car device, a wearable device, etc., which is not limited in the embodiment of the present invention.
[0072] In an embodiment of the present invention, the electronic device 102 may be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. It may also be a physical server or a server cluster, but is not limited to these.
[0073] Among them, the terminal device 101, the electronic device 102, and each terminal device 101 can be directly or indirectly connected to each other through one or more networks 103. The network 103 can be a wired network or a wireless network, for example, the wireless network can be a mobile cellular network, or a wireless fidelity (Wireless-Fidelity, WIFI) network, and of course it can be other possible networks, which are not limited in the embodiment of the present invention.
[0074] Of course, the method provided in the embodiment of the present invention is not limited to Figure 1The application scenario shown can also be used in other possible application scenarios, such as only the electronic device determines the display request and performs the display of the target web page based on the display request, which is not limited in the embodiment of the present invention. Figure 1 The functions that can be implemented by each device in the application scenario shown will be described in the subsequent method embodiments, and will not be described in detail here.
[0075] To further illustrate the technical solution provided by the embodiment of the present invention, the following is a detailed description of this in conjunction with the accompanying drawings and specific implementation methods. Although the embodiment of the present invention provides the method operation steps shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on routine or no creative labor. In the steps where there is no necessary causal relationship logically, the execution order of these steps is not limited to the execution order provided by the embodiment of the present invention. The method may be executed in the order of the method shown in the embodiment or drawings or in parallel during the actual processing process or when the device is executed.
[0076] See also Figure 2 , Figure 2 FIG. 1 is a flow chart of a webpage loading processing method in an embodiment of the present invention. The flow of the method may be executed by an electronic device, for example, and the electronic device may be Figure 1 The electronic device 102 in the embodiment of the present invention, the specific implementation process of the method is as follows:
[0077] Step 201: obtaining a target web page array according to the hierarchical information and sorting rules of each iframe page included in the target web page; the target web page array includes sorting indication information and uniform resource locator URL information corresponding to each iframe page.
[0078] In the embodiment of the present invention, the electronic device may first determine the target web page, which may be screened and determined based on a preset screening condition, or may be directly specified, which is not limited in the embodiment of the present invention. Optionally, in the actual implementation process, the browser may open multiple web pages at the same time, each of which may be used as a target web page, and the web page loading processing method provided by the embodiment of the present invention is executed on the target web page.
[0079] In the embodiment of the present invention, after the electronic device determines the target web page, it can obtain the target web page array according to the hierarchical information and sorting rules of each iframe page included in the target web page. For example, see Figure 3 , Figure 3 A schematic diagram of a process for determining a target web page array provided by an embodiment of the present invention. The electronic device may determine the target web page array by, but not limited to, the following steps:
[0080] Step 301: Sort each iframe page according to the hierarchical information and sorting rules of each iframe page included in the target webpage, and obtain sorting indication information of each iframe page.
[0081] In an embodiment of the present invention, the electronic device can perform a first sorting operation on each iframe page from high to low according to the hierarchical information of each iframe page included in the target web page, and obtain first sorting information of each iframe page; determine multiple sorting sets with the same first sorting information of the iframe pages, and based on the business importance corresponding to the iframe pages in each sorting set, perform a second sorting operation on the iframe pages in each sorting set, and obtain second sorting information of the iframe pages in each sorting set; based on the obtained first sorting information and second sorting information of each iframe page, obtain sorting indication information of each iframe page.
[0082] Step 302: Obtain a target web page array according to the sorting indication information corresponding to each iframe page.
[0083] In the embodiment of the present invention, the electronic device can obtain the target web page array according to the sorting indication information corresponding to each iframe page.
[0084] For example, assuming that the iframe pages included in the target webpage are page A with level information of level one, page B with level information of level two, page C with level information of level two, page D with level information of level three, and page A with level information of level four, wherein the URL information of page A with level information of level one and level four is the same, then the first ranking information of page A is determined to be A1, the first ranking information of page B is B2, the first ranking information of page C is C2, the first ranking information of page D is D3, and the first ranking information of page A is A4. Then, the ranking set is determined to include page B and page C, and based on the business importance corresponding to page B being 0.7 and the business importance corresponding to page C being 0.2, the second ranking information of page B is determined to be 1, and the second ranking information of page C is determined to be 2, so that the ranking indication information of page B is B21, and the ranking indication information of page C is C22, so that the target webpage array can be determined to be {A1, B21, C22, D3, A4}. Among them, A, B, C, and D can be understood as URL information corresponding to each iframe page.
[0085] After the array is formed based on the above method, if the page content is updated in real time, the method provided in the embodiment of the present application also updates the array in real time for the page content that is updated in real time. The specific implementation may be:
[0086] When the electronic device receives the new URL information corresponding to the new iframe page, it determines whether the new URL information exists in the target web page array; if the new URL information does not exist in the target web page array, the sorting indication information of the new iframe page is determined based on the hierarchical information of the new iframe page; based on the sorting indication information of the new iframe page, the new iframe page is added to the target web page array to obtain an updated target web page array.
[0087] In an embodiment of the present invention, a MutationObserver method can be called to monitor changes in the content of a target web page. When it is determined that the content of the target web page has changed, the latest new URL information of each iframe page of the target web page is obtained, and it is determined whether there is new URL information corresponding to the new iframe page in the target web page array. After it is determined that there is new URL information corresponding to the new iframe page, the sorting indication information of the new iframe page is determined based on the hierarchical information of the new iframe page; based on the sorting indication information of the new iframe page, the new iframe page is added to the target web page array to obtain an updated target web page array.
[0088] Step 202: Perform repeated loading detection on the target web page array based on an independent thread to obtain a detection result.
[0089] In an embodiment of the present invention, the independent thread is, for example, ShareWorker, and ShareWorker is used to provide transit communication for iframe pages of cross-domain communication. It can be seen that the detection of repeated loading in the embodiment of the present invention is completed in ShareWorker, which is independent of the main thread, that is, the JavaScript engine thread. The detection of repeated loading is placed in ShareWorker, which reduces the occupation of the JavaScript engine thread, thereby reducing the impact on the business functions of the page. In addition, the transmission of messages between pages is completed by using ShareWorker as a transit center. In this way, the message can be sent directly to the specified page through ShareWorker, and there is no need to pass it down from the top-level page one level at a time, making the message transmission more efficient. And because ShareWorker can send messages directly to the specified page, even if the iframe page in the target web page array is cross-domain, the message transmission can be quickly realized. The message is, for example, a message that specifies the parent page to delete the iframe tag.
[0090] Step 203: When it is determined that the detection result indicates that the target web page array includes multiple iframe pages with the same URL information, delete the second iframe page information among the multiple iframe pages except the first iframe page with the highest ranking indicated by the ranking indication information.
[0091] In an embodiment of the present invention, the parent page of each second iframe page except the first iframe page among multiple iframe pages is determined; for example, the parent page of each second iframe page except the first iframe page can be determined based on the unique identifier of the parent page and the unique identifier of the child page and the identifier association relationship, so that the parent page can be quickly determined based on the unique identifier, and a message is sent to each parent page, so that the corresponding second iframe page information is deleted from the information of each parent page. The information of the iframe page can be understood as an iframe tag.
[0092] Step 204: receiving a request to load a second iframe page, and loading the second iframe page based on resources of the first iframe page.
[0093] It can be seen that in the embodiment of the present invention, only the resources of one iframe page can be used to load the iframe page that is repeatedly loaded therewith, thereby avoiding the occurrence of repeated loading and improving the performance of web page loading.
[0094] See also Figure 4 , Figure 4 The schematic diagram of the framework of a webpage loading processing system in an embodiment of the present invention includes a monitoring module, a detection module, a transfer module and a server module.
[0095] The monitoring module mainly performs the following three functions:
[0096] Function 1: Used to initialize the detection module and transfer module.
[0097] Optionally, since the functions of the detection module are placed in a separate js file, you can create a ShareWorker instance object and execute the js file to initialize the detection module. In other words, you can obtain the js file address information of the detection module, execute the ShareWorker method to create a ShareWorker instance object, and the instance object will establish a message listener to receive messages from the transfer module.
[0098] Optionally, an iframe tag object can be embedded in the target web page. The iframe tag object loads a web page provided by the server module that specifically implements the message forwarding function. This function will call the API of the ShareWorker instance object to establish a message monitoring for the detection module, and then send the URL information of each iframe page in the target web page to the monitoring module for storage. The monitoring module will use the URL information to send a message to the specified page to delete the specified iframe page.
[0099] For example, create an iframe tag object; set the src attribute of the iframe tag object to the provided transit page URL, and add the iframe tag object to the target web page. Then you can set the iframe tag style to make the iframe tag element hidden on the target web page. Furthermore, you can obtain the target web page information and ShareWorker instance object information, call the ShareWorker instance object API to send the target web page information and ShareWorker instance object information to an independent thread, such as ShareWorker, which is used to provide transit communication for iframe pages for cross-domain communication. In this way, the target web page information and ShareWorker instance object information are saved to facilitate feedback to the main thread after obtaining the detection results. In addition, you can also call the ShareWorker instance object API to establish a message monitor for ShareWorker.
[0100] Function 2: monitor the URL changes of the target web page in real time. If any change occurs, determine the latest target web page array corresponding to the target web page and send the target web page array to the detection module; Function 3: upon receiving the message sent by the detection module to delete the iframe page, determine the parent page of the iframe page and delete the information of the iframe page from the parent page information.
[0101] The detection module runs in an independent thread ShareWorker, and is used to traverse the target web page array to check whether there are duplicate pages in the target web page array. If so, the iframe page to be deleted is determined, and then a message to delete the iframe page is sent to the monitoring module. The message is used to indicate that the information of the iframe page to be deleted should be deleted in the parent page corresponding to the iframe page to be deleted.
[0102] The transfer module is mainly used to forward messages from the monitoring module and the detection module. Since the detection module runs in ShareWorker and the monitoring module runs in the web page, it is necessary to embed a transfer module in the same domain in each web page, so that the transfer modules of all pages are in the same domain. In this way, all transfer modules can communicate with ShareWorker, and the transfer module can also communicate with its parent page. In other words, the transfer module can be understood as a message forwarding center, forwarding messages from the monitoring module and the detection module.
[0103] The server module can be understood as a web server, and all web page transfer modules access the web pages of the server, thereby ensuring that each transfer module is in the same domain.
[0104] Based on the same inventive concept, an embodiment of the present invention also provides a web page loading processing device. Figure 5 As shown, it is a schematic diagram of the structure of a webpage loading processing device 500, which may include:
[0105] The first obtaining unit 501 is used to obtain a target web page array according to the hierarchical information and sorting rules of each iframe page included in the target web page; the target web page array includes sorting indication information and uniform resource locator URL information corresponding to each iframe page;
[0106] A second obtaining unit 502 is used to perform repeated loading detection on the target web page array based on an independent thread to obtain a detection result;
[0107] The processing unit 503 is configured to, when it is determined that the detection result indicates that the target web page array includes multiple iframe pages with the same URL information, delete each second iframe page among the multiple iframe pages except for the first iframe page with the highest ranking indicated by the ranking indication information;
[0108] The loading unit 504 is used to receive a request to load any of the second iframe pages, and load any of the second iframe pages based on the resources of the first iframe page.
[0109] In a possible implementation manner, the first obtaining unit 501 is specifically configured to:
[0110] Sort the iframe pages according to the hierarchical information and sorting rules of the iframe pages included in the target webpage, and obtain sorting indication information of the iframe pages;
[0111] According to the sorting indication information corresponding to each iframe page, an array of target web pages is obtained.
[0112] In a possible implementation manner, the first obtaining unit is specifically configured to:
[0113] According to the hierarchical information of each iframe page included in the target webpage, a first sorting operation is performed on each iframe page from high to low to obtain first sorting information of each iframe page;
[0114] Determine multiple sorting sets with the same first sorting information of the iframe pages, and perform a second sorting operation on the iframe pages in each sorting set based on the business importance corresponding to the iframe pages in each sorting set to obtain second sorting information of the iframe pages in each sorting set;
[0115] Based on the obtained first sorting information and second sorting information of each iframe page, sorting indication information of each iframe page is obtained.
[0116] In a possible implementation manner, the device further includes an updating unit, configured to:
[0117] After receiving the new URL information corresponding to the new iframe page, determining whether the new URL information exists in the target web page array;
[0118] If the target web page array does not contain the new URL information, determining the sorting indication information of the new iframe page based on the hierarchical information of the new iframe page;
[0119] Based on the sort indication information of the new iframe page, the new iframe page is added to the target web page array to obtain an updated target web page array.
[0120] In a possible implementation manner, the processing unit 503 is specifically configured to:
[0121] Determine the parent page of each second iframe page;
[0122] In the information of each parent page, delete the corresponding information of the second iframe page.
[0123] In a possible implementation, the independent thread is ShareWorker; and the ShareWorker is used to provide relay communication for the iframe page of cross-domain communication.
[0124] For the convenience of description, the above parts are divided into modules (or units) according to their functions and described separately. Of course, when implementing the present invention, the functions of each module (or unit) can be implemented in the same or multiple software or hardware.
[0125] After introducing the webpage loading processing method and device according to the exemplary embodiment of the present invention, next, an electronic device according to another exemplary embodiment of the present invention is introduced.
[0126] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0127] Based on the same inventive concept as the above method embodiment, an electronic device is also provided in the embodiment of the present invention. In this embodiment, the structure of the electronic device can be as follows Figure 6 As shown, the electronic device is, for example, the aforementioned Figure 1 The electronic device 102, such as Figure 6 As shown, the electronic device in the embodiment of the present invention includes at least one processor 601, and a memory 602 and a communication interface 603 connected to the at least one processor 601. The specific connection medium between the processor 601 and the memory 602 is not limited in the embodiment of the present invention. Figure 6 In the example, the processor 601 and the memory 602 are connected via the system bus 600. Figure 6 The connections between other components are shown in bold lines, and are not intended to be limiting. The system bus 600 can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0128] In the embodiment of the present invention, the memory 602 stores instructions that can be executed by at least one processor 601. The at least one processor 601 can execute the steps included in the aforementioned web page loading processing method by executing the instructions stored in the memory 602.
[0129] Among them, the processor 601 is the control center of the electronic device, and various interfaces and lines can be used to connect various parts of the entire electronic device. By running or executing instructions stored in the memory 602 and calling data stored in the memory 602, various functions of the electronic device can be realized. Optionally, the processor 601 may include one or more processing units, and the processor 601 may integrate an application processor and a modem processor, wherein the processor 601 mainly processes the operating system, the customer interface and the application program, etc., and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 601. In some embodiments, the processor 601 and the memory 602 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.
[0130] The processor 601 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiments of the present invention may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0131] The memory 602 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 602 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 602 is any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 602 in the embodiment of the present invention can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0132] The communication interface 603 is a transmission interface that can be used for communication, and data can be received or sent through the communication interface 603 .
[0133] In addition, the electronic device also includes a basic input / output system (I / O system) 604 for facilitating information transmission between various components within the electronic device, and a large-capacity storage device 608 for storing an operating system 605, application programs 606 and other program modules 607.
[0134] The basic input / output system 604 includes a display 609 for displaying information and an input device 610 such as a mouse and a keyboard for a client to input information. The display 609 and the input device 610 are connected to the processor 601 through the basic input / output system 604 connected to the system bus 600. The basic input / output system 604 may also include an input / output controller for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller also provides output to a display screen, a printer, or other types of output devices.
[0135] Specifically, the mass storage device 608 is connected to the processor 601 via a mass storage controller (not shown) connected to the system bus 600. The mass storage device 608 and its associated computer-readable medium provide non-volatile storage for the server package. That is, the mass storage device 608 may include a computer-readable medium (not shown) such as a hard disk or a CD-ROM drive.
[0136] According to various embodiments of the present invention, the electronic device can also be connected to a remote computer on the network through a network such as the Internet to run. That is, the electronic device can be connected to the network 611 through the communication interface 603 connected to the system bus 600, or in other words, the communication interface 603 can also be used to connect to other types of networks or remote computer systems (not shown).
[0137] An embodiment of the present invention further provides a computer storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is used to enable a computer to execute the technical solution of the web page loading processing method of the above embodiment.
[0138] An embodiment of the present invention further provides a computer program product, which includes: a computer program code, and when the computer program code runs on a computer, the computer can implement the technical solution of the web page loading processing method in the above embodiment when executing the computer program.
[0139] It can be understood by those skilled in the art that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions, the aforementioned program instructions belong to a computer program, the computer program can be stored in a computer-readable storage medium, and when the computer program is executed, the steps of the above method embodiments are executed; the readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0140] The program product of the embodiment of the present invention can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a computing device. However, the program product of the present invention is not limited to this. In this document, a readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with a command execution system, device or device.
[0141] The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein the readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with a command execution system, apparatus, or device.
[0142] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0143] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the computing device, partially on the electronic device, as a separate software package, partially on the computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0144] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0145] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A web page loading processing method, characterized in that: The method comprises: According to the hierarchical information and sorting rules of each iframe page included in the target webpage, a target webpage array is obtained; the target webpage array includes sorting indication information and uniform resource locator URL information corresponding to each iframe page; Perform repeated loading detection on the target web page array based on an independent thread to obtain a detection result; When it is determined that the detection result indicates that the target web page array includes multiple iframe pages with the same URL information, deleting each second iframe page among the multiple iframe pages except for the first iframe page with the highest ranking indicated by the ranking indication information; A request to load any of the second iframe pages is received, and any of the second iframe pages is loaded based on resources of the first iframe page.
2. The method according to claim 1, characterized in that According to the hierarchical information and sorting rules of each iframe page included in the target webpage, the target webpage array is obtained, including: Sort the iframe pages according to the hierarchical information and sorting rules of the iframe pages included in the target webpage, and obtain sorting indication information of the iframe pages; According to the sorting indication information corresponding to each iframe page, an array of target web pages is obtained.
3. The method according to claim 2, characterized in that According to the hierarchical information and sorting rules of each iframe page included in the target webpage, the iframe pages are sorted to obtain the sorting indication information of each iframe page, including: According to the hierarchical information of each iframe page included in the target webpage, a first sorting operation is performed on each iframe page from high to low to obtain first sorting information of each iframe page; Determine multiple sorting sets with the same first sorting information of the iframe pages, and perform a second sorting operation on the iframe pages in each sorting set based on the business importance corresponding to the iframe pages in each sorting set to obtain second sorting information of the iframe pages in each sorting set; Based on the obtained first sorting information and second sorting information of each iframe page, sorting indication information of each iframe page is obtained.
4. The method according to claim 3, characterized in that The method further comprises: After receiving the new URL information corresponding to the new iframe page, determining whether the new URL information exists in the target web page array; If the target web page array does not contain the new URL information, determining the sorting indication information of the new iframe page based on the hierarchical information of the new iframe page; Based on the sort indication information of the new iframe page, the new iframe page is added to the target web page array to obtain an updated target web page array.
5. The method according to claim 4, characterized in that Deleting each second iframe page among the multiple iframe pages except for the first iframe page with the highest ranking indicated by the ranking indication information, comprises: Determine the parent page of each second iframe page; In the information of each parent page, delete the corresponding information of the second iframe page.
6. The method according to any one of claims 1 to 5, characterized in that: The independent thread is ShareWorker; the ShareWorker is used to provide transit communication for the iframe page of cross-domain communication.
7. A web page loading processing device, characterized in that: The device comprises: A first obtaining unit is used to obtain a target web page array according to the hierarchical information and sorting rules of each iframe page included in the target web page; the target web page array includes sorting indication information and uniform resource locator URL information corresponding to each iframe page; A second obtaining unit is used to perform repeated loading detection on the target web page array based on an independent thread to obtain a detection result; a processing unit, configured to, when it is determined that the detection result indicates that the target web page array includes multiple iframe pages with the same URL information, delete each second iframe page among the multiple iframe pages except for the first iframe page with the highest ranking indicated by the ranking indication information; A loading unit is used to receive a request to load any of the second iframe pages, and load any of the second iframe pages based on the resources of the first iframe page.
8. An electronic device, characterized in that: The invention comprises 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 implement the method as claimed in any one of claims 1 to 6.
9. A computer storage medium, characterized in that The computer storage medium stores a computer program, and the computer program is used to enable a computer to execute the method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The computer program product comprises: a computer program code, and when the computer program code is run on a computer, the computer is enabled to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Page reusing method and page reusing device
CN104573066A
Iframe-based nested multiplexing system and method, electronic equipment and storage medium
CN114489631A
Page resource preloading method and device and storage medium
CN115061745A
Systems and methods for optimizing web page load time
US20160103803A1
