Cross-webpage communication method and device, equipment, storage medium and program product

By running the first subweb page in the first web page, which is the same as the second web page, the problem that the Broadcast Channel method in the prior art is not suitable for point-to-point communication, and efficient communication between different source web pages is achieved.

CN120030259APending Publication Date: 2025-05-23TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510177213.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-05-23

AI Technical Summary

Technical Problem

The Broadcast Channel-based message broadcast to all followers in the prior art is not suitable for scenarios where point-to-point communication is required, and the versatility is poor.

Method used

By running the first subweb page in the first web page, the subweb page is created by an embedded component and is a homologous web page with the second web page, cross-web page communication between the first web page and the second web page is realized.

Benefits of technology

Cross-web page communication between any two different sources is realized, with good versatility and suitable for scenarios where point-to-point communication is required.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120030259A_ABST
    Figure CN120030259A_ABST
Patent Text Reader

Abstract

The invention discloses a cross-webpage communication method and device, equipment, a storage medium and a program product, and relates to the technical field of computers. The method comprises the steps that under the condition that a first webpage is in an opened state, a first sub-webpage is operated, the first webpage comprises an entry control, the entry control is used for opening a second webpage different from the first webpage in source, the first sub-webpage is created through a component embedded in the first webpage, and the first sub-webpage and the second webpage are homologous webpages; opening a second webpage in response to an operation for the entry control; under the condition that the second webpage is in an opened state and the webpage data of the second webpage are changed, obtaining the webpage data of the second webpage from the first sub-webpage; and under the condition that the first webpage is in the display state, sending webpage data to the first webpage by the first sub-webpage. According to the method, mutual communication between any two webpages which need to be communicated and are of different sources can be realized, and the universality is relatively good.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a cross-webpage communication method, device, equipment, storage medium and program product. Background Art

[0002] The same-origin policy is a security mechanism of the browser, which stipulates that a web page within a source (i.e. a combination of protocol, domain name and port) can only access resources within that source, and cannot access resources from other sources. Due to the restrictions of the browser's same-origin policy, only web pages from the same source can communicate with each other. These two web pages are also called same-origin web pages.

[0003] Considering the limitation of the same-origin policy, in the related art, a communication channel is created between web pages of the same or different origins by means of a Broadcast Channel. Through the communication channel, messages can be broadcasted to all web pages that follow the communication channel.

[0004] However, in the Broadcast Channel method of the above-mentioned related technologies, messages are broadcast to all followers, which is not suitable for scenarios requiring point-to-point communication and has poor versatility. Summary of the invention

[0005] The embodiments of the present application provide a cross-webpage communication method, apparatus, device, storage medium and program product, which can realize mutual communication between any two webpages of different sources that need to communicate, and have good versatility. The technical solutions provided by the embodiments of the present application are as follows:

[0006] According to one aspect of an embodiment of the present application, a cross-webpage communication method is provided, the method comprising:

[0007] When a first webpage is in an open state, a first sub-webpage is run, the first webpage includes a portal control, the portal control is used to open a second webpage of a different source from the first webpage, the first sub-webpage is created by a component embedded in the first webpage, and the first sub-webpage and the second webpage are webpages of the same source;

[0008] In response to an operation on the portal control, opening the second webpage;

[0009] When the second webpage is in an opened state and webpage data of the second webpage changes, the first sub-webpage obtains the webpage data;

[0010] When the first web page is in a display state, the first sub-web page sends the web page data to the first web page.

[0011] According to one aspect of an embodiment of the present application, a cross-webpage communication device is provided, the device comprising:

[0012] a running module, configured to run a first sub-webpage when a first webpage is in an opened state, wherein the first webpage includes a portal control, the portal control is configured to open a second webpage of a different origin from the first webpage, the first sub-webpage is created by a component embedded in the first webpage, and the first sub-webpage and the second webpage are webpages of the same origin;

[0013] The running module is further configured to open the second webpage in response to an operation on the portal control;

[0014] an acquisition module, configured to acquire the webpage data from the first sub-webpage when the second webpage is in an opened state and the webpage data of the second webpage is changed;

[0015] The sending module is used to send the webpage data to the first webpage from the first sub-webpage when the first webpage is in a display state.

[0016] According to one aspect of an embodiment of the present application, a terminal device is provided, the terminal device comprising a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the above-mentioned cross-webpage communication method.

[0017] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned cross-webpage communication method.

[0018] According to one aspect of an embodiment of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a terminal device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the terminal device executes the above-mentioned cross-webpage communication method.

[0019] The technical solution provided by the embodiments of the present application may have the following beneficial effects:

[0020] Compared with the related art, in which the message is broadcast to all web pages that pay attention to the communication channel, the present application introduces the first sub-webpage as an intermediate medium, realizes cross-webpage communication between any two web pages of different sources, and has good versatility. Specifically, the first sub-webpage is created by a component embedded in the first webpage, so the first sub-webpage and the first webpage can communicate with each other. When the first sub-webpage is created by the component embedded in the first webpage, the created first sub-webpage and the second webpage are web pages of the same source, so the first sub-webpage and the second webpage can communicate with each other. Since the first sub-webpage and the first webpage can communicate with each other, the first sub-webpage and the second webpage can communicate with each other, that is, the mutual communication between the first webpage and the second webpage is indirectly realized. In the case where the webpage data of the second webpage changes, the second webpage sends the webpage data of the second webpage to the first sub-webpage. When displaying the first webpage, the first webpage receives the webpage data of the second webpage sent by the first sub-webpage. Based on this, cross-webpage communication between the first webpage and the second webpage of non-same source with the first sub-webpage as the intermediate medium is realized, which is suitable for any two webpages of different sources that need to communicate, and has good versatility. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 is a schematic diagram of a computer system provided by an embodiment of the present application;

[0022] Figure 2 is a schematic diagram of a cross-webpage communication method provided by an embodiment of the present application;

[0023] Figure 3 is a flow chart of a cross-webpage communication method provided by an embodiment of the present application;

[0024] Figure 4 is a flow chart of a cross-webpage communication method provided by another embodiment of the present application;

[0025] Figure 5 is a flow chart of a cross-webpage communication method provided by another embodiment of the present application;

[0026] Figure 6 is a block diagram of a cross-webpage communication method provided by an embodiment of the present application;

[0027] Figure 7 is a schematic diagram of a first web page and a second web page provided by an embodiment of the present application;

[0028] Figure 8 is a schematic diagram of a first webpage and a second webpage provided by another embodiment of the present application;

[0029] Fig. 9 is a schematic diagram of a first webpage and a second webpage provided by another embodiment of the present application;

[0030] Fig.10 is a schematic diagram of a first webpage and a second webpage provided by another embodiment of the present application;

[0031] Fig.11 is a block diagram of a cross-webpage communication method provided by another embodiment of the present application;

[0032] Fig.12 is a block diagram of a cross-webpage communication method provided by another embodiment of the present application;

[0033] Fig.13 is a flow chart of a cross-webpage communication method provided by another embodiment of the present application;

[0034] Fig.14 is a flow chart of a cross-webpage communication method provided by another embodiment of the present application;

[0035] Fig.15 is a flow chart of a cross-webpage communication method provided by another embodiment of the present application;

[0036] Fig.16 is a block diagram of a cross-webpage communication device provided by an embodiment of the present application;

[0037] Fig.17 This is a structural block diagram of a terminal device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0038] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0039] Before introducing the embodiments of the present application, some terms involved in the present application are first explained. The following related explanations can be combined arbitrarily with the technical solutions of the embodiments of the present application as optional solutions, and they all belong to the protection scope of the embodiments of the present application. The embodiments of the present application include at least part of the following contents.

[0040] Homologous webpages: refers to webpages with the same protocol, domain name and port. In other words, if the three elements of two webpages are exactly the same, then they are considered to be homologous webpages. The webpages in the embodiments of the present application are also considered to be pages.

[0041] Non-same-origin web pages: The protocols, domain names and / or port numbers of two web pages are not exactly the same, and they are considered to have different origins. The main feature of non-same-origin web pages is that at least one of their protocols, domain names or port numbers is different. This causes the browser to activate the cross-domain restriction policy and prevent direct access and interaction between these web pages of different origins.

[0042] Same-Origin Policy: It is a security policy of browsers. It stipulates that scripts within a single origin (i.e., a combination of protocol, domain name, and port) can only access resources within that origin and cannot access resources from other origins. This is to prevent malicious websites from stealing data or conducting cross-site attacks. It defines how documents or scripts within one origin interact with resources from another origin. Here, "origin" refers to the combination of protocol (such as http, https), domain name (such as example.com), and port number (such as 8080). Only when the origins of two resources are exactly the same are they considered to be from the same origin and can access and operate on each other.

[0043] Cookie: It is a small text file stored on the user's computer hard drive by a web server, which records information related to web browsing behavior. Cookies can be classified into various types according to their characteristics and uses: Session Cookie (temporary cookie): It exists only during the period when the user's browser is open and is automatically deleted when the browser is closed. It is mainly used to retain short-term information when the user browses a website. Persistent Cookie: It continues to exist even after the browser is closed until a preset expiration date. It is used to store information that needs to be saved for a long time, such as login credentials, user preference settings, etc. Third-Party Cookie: A cookie set by a domain other than the website the user is currently accessing. It is commonly used for user tracking, advertising targeting, and content recommendation. Flash Cookie (super cookie): It is independent of the browser and is designed to be permanently stored on the user's device. Even after regular browser cookies are deleted, it can still retain information. Due to its difficult-to-delete feature, it has raised some privacy and security concerns. Zombie Cookie: A special type of Flash Cookie that can recreate itself after being deleted. It is mainly used to prevent online cheating behavior but has also been reported to be used for malware propagation. Secure Cookie: A cookie that can only be set and used under an https connection. It encrypts data transmission to ensure the security of transactions, such as e-commerce and online banking operations.

[0044] User Interface (UI) Controls: Any visible control or element that can be seen on the user interface of an application, such as controls like pictures, input boxes, text boxes, buttons, labels, etc. Some of these UI controls respond to user operations. For example, a first control is used to open a second web page. The user presses the first control to open the second web page. The UI controls involved in the embodiments of this application include, but are not limited to: the first control.

[0045] Please refer to Figure 1, which shows a schematic diagram of a computer system provided by an exemplary embodiment of the present application. The computer system may include: a terminal device 10 and a server 20.

[0046] The terminal device 10 includes, but is not limited to, mobile phones, tablet computers, intelligent voice interaction devices, game consoles, wearable devices, multimedia playback devices, PCs (Personal Computers), vehicle-mounted terminals, smart home appliances and other electronic devices. The client of the target application can be installed in the terminal device 10. Optionally, the target application can be an application that needs to be downloaded and installed, or it can be in the form of a web page or a small program, which is not limited in the embodiments of the present application.

[0047] In the embodiment of the present application, the target application is an application for implementing cross-webpage communication. Figure 2 As shown, the target application includes a first web page 200 and a second web page 201. Exemplarily, the first web page 200 and the second web page 201 are two web pages of the same level or different levels. Exemplarily, when developing the first web page 200, a component is embedded in the first web page 200, and the properties of the web page that the component can create are configured. Exemplarily, the first sub-web page 202 that can be created by configuring the component is a web page of the same source as the second web page 201. Exemplarily, the source of the first sub-web page 202 is determined according to the source of the second web page 201. Exemplarily, when running the application, when opening the first web page 200, the first sub-web page 202 is created based on the pre-embedded components and pre-configured properties therein. Exemplarily, when the second web page 201 is in an opened state, the second web page 201 and the first sub-web page 200 can communicate with each other because of the same source. At the same time, since the first sub-webpage 202 and the first webpage 202 can also communicate with each other, the first sub-webpage 202 obtains the webpage data of the second webpage 201 from the second webpage 201, and forwards it to the first webpage 200, so as to realize the cross-webpage communication between the first webpage 200 and the second webpage 201. Of course, there is no limitation on the specific type of the target application, and the type of the target application can be a video conferencing application, a database application, a question-and-answer application, a social application, a search application, a game application, a virtual reality application, an augmented reality application, an instant messaging application, an enterprise-level instant messaging application, etc. The embodiment of the present application does not limit the specific category of the target application. In other embodiments, the target application can be considered as a separate functional module, such as a video conferencing application, one of which is used to realize cross-webpage communication. Exemplarily, the client of the above-mentioned target application is running in the terminal device 10.

[0048] The server 20 is used to provide background services for the client of the target application in the terminal device 10. For example, the server 20 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or 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, CDN (Content Delivery Network), and big data and artificial intelligence platforms, but is not limited to these.

[0049] The terminal device 10 and the server 20 can communicate with each other via a network, which can be a wired network or a wireless network.

[0050] Please refer to Figure 3 , which shows a flow chart of a cross-webpage communication method provided by an embodiment of the present application. The execution subject of the method may be the terminal device 10 introduced above, such as the execution subject of each step is the client of the target application mentioned in the above embodiment. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as the "terminal device". The method may include at least one of the following steps (310-340).

[0051] Step 310, when the first web page is in an open state, run the first sub-web page, the first web page includes a portal control, the portal control is used to open a second web page that is not from the same source as the first web page, the first sub-web page is created by a component embedded in the first web page, and the first sub-web page and the second web page are from the same source.

[0052] In some embodiments, the first sub-page of the first webpage is considered to be a non-independent webpage, which is different from the first webpage (which is an independent webpage). Exemplarily, the first sub-page of the first webpage is considered to be a non-independent webpage, which is different from the second webpage (which is an independent webpage).

[0053] In some embodiments, when developing an application, during the development process of a first webpage, a component is embedded in the first webpage, which is used to create a first sub-webpage when the first webpage is opened. Exemplarily, during the development process, the properties of the first sub-webpage are configured. Exemplarily, the properties of the first sub-webpage include the source of the first sub-webpage. Exemplarily, the source of the first sub-webpage is configured to be the same as the source of the second webpage, that is, the first sub-webpage and the second webpage are implemented as the same-source webpages.

[0054] In some embodiments, the component is a component for creating a sub-webpage for the first webpage. Exemplarily, the component is an iframe. In some embodiments, an iframe is an element in HTML (Hyper Text Markup Language), also known as an Inline Frame. It allows the content of another webpage to be embedded in the current webpage. By using an iframe, a developer can display the content or functionality of another webpage to a user without leaving the current webpage.

[0055] In some embodiments, when the application is run, if the first webpage is opened, the first sub-webpage is created using the embedded component. Exemplarily, the first sub-webpage is created using the embedded component and the configured properties of the first sub-webpage. In some embodiments, the number of first sub-webpages is one or more. Exemplarily, when the number of second webpages that interact with the first webpage is multiple, the number of first sub-webpages is also multiple, and each first sub-webpage corresponds to each second webpage.

[0056] In some embodiments, if the first webpage is closed, the first sub-webpage is destroyed. In some embodiments, if the first webpage is not closed, the first sub-webpage is kept. In some embodiments, if the second webpage is opened from the first webpage, the first webpage is considered not to be closed and the first sub-webpage is kept. In other embodiments, if the first webpage is completely closed, the first sub-webpage is destroyed. Exemplarily, when the first webpage is opened again, the component is reused to create the first sub-webpage.

[0057] In some embodiments, the component is an iframe, the first sub-webpage is a sub-webpage constructed by the iframe, and the first sub-webpage is not displayed. In some embodiments, the first sub-webpage is not displayed on the user interface of the application. Exemplarily, the first sub-webpage is invisible on the user interface. Therefore, the first sub-webpage does not affect the webpage layout or webpage style of the webpage displayed on the user interface. Exemplarily, the first sub-webpage can be a blank-style webpage, which is not displayed on the user interface, and the first sub-webpage is a hidden webpage.

[0058] In this application, both the first page and the second page are independent pages. So it is impossible to put any page into an iframe. In the related art, the second page is directly designed as an iframe subpage. As an independent page, it is visible and displayed on the homepage in a special style, and the effect of independent page to independent page cannot be achieved. In the related art, the iframe needs to be displayed as a page, but the iframe in this application is hidden and only serves as a communication medium between the two main pages. In this solution, the iframe is hidden and cannot be seen by the user. It only serves as an intermediary. In the related art, the page is basically placed in an iframe, and compromises will be made in the design. For example, the two pages will not be displayed as an independent page. Generally, the iframe subpage will need to be displayed as a page, such as a pop-up window. This application can realize the communication between two independent pages. Regardless of whether the two pages are from the same source, it can be realized in the page effect, and the display method of one independent page to another independent page.

[0059] Specifically, when the home page is rendered (closing and re-entering the home page also requires re-rendering the page), an iframe is created at the same time. As long as the page is not closed later, the same iframe is reused, so the performance is better and the user experience is smooth. In this application, a sub-page with only logic but no style is placed in the iframe, and the sub-page is required to be deployed under the same domain name as the secondary page. The iframe does not produce data here, it is just an intermediate connection. It receives data from the secondary page and then transmits the data to the home page.

[0060] The technical solution provided by the embodiment of the present application uses the iframe component to construct the first sub-page, thereby ensuring mutual communication between the first page and the first sub-page. Furthermore, since the first sub-page is invisible, visual interference is minimized as much as possible, unnecessary display costs are avoided, and users can also be given a better visual experience.

[0061] Step 320, in response to the operation on the entry control, open the second web page.

[0062] In some embodiments, the situation where the second webpage is in an opened state here can also be considered as the above-mentioned situation of opening the second webpage based on the first webpage. Of course, the second webpage here can be in an opened state on the same terminal device as the first webpage, or can be in an opened state on a different terminal device. Exemplarily, the first webpage is opened on a first terminal device, and the second webpage is opened on a second terminal device, and the first terminal device and the second terminal device are the same terminal device, or different terminal devices. Exemplarily, whether the first webpage and the second webpage are on the same terminal device or not, it does not affect the first webpage obtaining the webpage data of the second webpage through the first sub-webpage.

[0063] In some embodiments, there is an entrance to the second web page on the first web page, such as the first control (or entry control) mentioned above. Exemplarily, in response to an operation on the first control, the second web page is opened. Exemplarily, in response to an operation on the first control, the second web page is opened. Exemplarily, in response to an operation on the first control, after the second web page is opened, the second web page is in an opened state. In some embodiments, the first web page does not have an entrance to the second web page, but when the second web page is in an opened state, web page data from the second web page can still be obtained through the first sub-web page of the first web page.

[0064] In some embodiments, when there are multiple second web pages, each second web page corresponds to a first sub-web page. Exemplarily, for the ith second web page, the web page data from the ith second web page is obtained through the ith first sub-web page. Exemplarily, the ith first sub-web page is a sub-web page created by a component embedded in the first web page. Exemplarily, the ith first sub-web page and the ith second web page are homologous web pages. i is a positive integer. Exemplarily, for the specific implementation method of obtaining the web page data from the ith second web page through the ith first sub-web page, please refer to the explanation of other embodiments in the context, which will not be repeated.

[0065] In some embodiments, the first sub-webpage and the second webpage are homologous webpages. Exemplarily, the first sub-webpage and the second webpage have the same following: protocol, domain name, and port. Exemplarily, the first sub-webpage and the second webpage have the same protocol, such as both are protocol 2. Exemplarily, the first sub-webpage and the second webpage have the same domain name, such as both are domain name B. Exemplarily, the first sub-webpage and the second webpage have the same port, such as both are port b.

[0066] In some embodiments, the second webpage is related to the first webpage. For example, the first webpage wants to receive data from the second webpage, and the second webpage wants to send data to the first webpage. For example, the first webpage and the second webpage are two webpages of the same or different levels, and the present application does not limit the hierarchical relationship between the first webpage and the second webpage.

[0067] In some embodiments, the first web page and the second web page are web pages of different levels. Exemplarily, the first web page is the parent web page of the second web page. Conversely, the second web page is the subordinate web page of the first web page. Exemplarily, the first web page is the parent web page of the second web page, that is, the first web page is the parent-level web page of the second web page. Conversely, the second web page is the subordinate web page of the first web page, that is, the second web page is the sub-level web page of the first web page. Exemplarily, the first web page is the upper N-level web page of the second web page. Conversely, the second web page is the lower N-level web page of the first web page, where N is a positive integer greater than 1. Exemplarily, in the case where the first web page is the parent-level web page of the second web page, if the first web page is considered to be the home page, then the second web page is called a secondary page.

[0068] Exemplarily, when the first webpage and the second webpage are webpages of different levels, the second webpage in step 320 is in an opened state, which can be considered as opening the second webpage in response to an operation on the first webpage. Exemplarily, a first control is displayed on the first webpage, and the second webpage is opened in response to an operation on the first control. Exemplarily, the operation on the first control is considered to be at least one of a click operation, a long press operation, a selection operation, etc. on the first control. Exemplarily, the first control is a UI control.

[0069] In some embodiments, the first webpage and the second webpage are webpages of the same level. Exemplarily, the first webpage is a subordinate webpage of the third webpage, and the second webpage is also a subordinate webpage of the third webpage. Exemplarily, the third webpage is a common superior webpage of the first webpage and the second webpage. Exemplarily, the third webpage is a webpage provided by an application. Exemplarily, if the third webpage is called a homepage, then the first webpage and the second webpage are both secondary pages.

[0070] Exemplarily, a second control and a third control are displayed on the third web page for opening the first web page and the second web page, respectively. Exemplarily, a second control is displayed on the third web page, and in response to an operation on the second control, the first web page is opened. Exemplarily, the operation on the second control is considered to be at least one of a click operation, a long press operation, a selection operation, etc. on the second control. Exemplarily, the second control is a UI control. Exemplarily, a third control is displayed on the third web page, and in response to an operation on the third control, the second web page is opened. Exemplarily, the operation on the third control is considered to be at least one of a click operation, a long press operation, a selection operation, etc. on the third control. Exemplarily, the third control is a UI control.

[0071] Exemplarily, when the first web page and the second web page are web pages of different levels, the second web page in step 320 is in an opened state, which can be considered as returning from the first web page to the third web page after opening the first web page, and then opening the second web page based on the third web page. The steps here are referred to as opening the second web page based on the first web page. The opening of the second web page based on the third web page involved here refers to the opening of the second web page based on the first web page when the first web page and the second web page are web pages of different levels, and will not be repeated.

[0072] Exemplarily, a return control is displayed on each web page, and the return control is used to return to the web page of the previous level. Exemplarily, in response to an operation on the return control on the first web page, the third web page is opened. Exemplarily, the operation on the return control is considered to be at least one of a click operation, a long press operation, a selection operation, etc. on the return control. Exemplarily, the return control is a UI control.

[0073] In some embodiments, both the first web page and the second web page are independent web pages. Exemplarily, the second web page is an independent web page, and the second web page is different from the sub-web page constructed by the component embedded in the first web page. Exemplarily, an independent web page is a complete web page, which contains its own HTML, CSS (Cascading Style Sheets) and JavaScript files, as well as other resources such as pictures and videos that may be included. An independent web page usually has a complete web page structure, including parts such as a header, a body, and a footer. Each independent web page is a complete document that can be opened and displayed independently in a browser.

[0074] The technical solution of the embodiment of the present application does not limit the hierarchy between the first web page and the second web page. When the second web page is a subordinate web page of the first web page, the web page data of the second web page can be sent to the first web page in a timely manner when returning from the second web page to the first web page, and displayed on the first web page, thereby ensuring mutual communication between the superior and subordinate non-homologous web pages.

[0075] Step 330: When the second webpage is in an open state, the first sub-webpage obtains webpage data of the second webpage.

[0076] In some embodiments, when the second webpage is in an opened state and the webpage data of the second webpage changes, the webpage data of the second webpage is acquired by the first sub-webpage.

[0077] In some embodiments, when the second webpage is in an opened state, the webpage data of the second webpage is obtained by the first sub-webpage regardless of whether the webpage data of the second webpage is changed.

[0078] In some embodiments, when a second webpage is opened based on a first webpage, if the second webpage is opened, the second webpage obtains webpage data of the second webpage.

[0079] In some embodiments, the first webpage and the second webpage are two different webpages in the application. Exemplarily, the second webpage and the first webpage are non-homologous webpages. In some embodiments, the second webpage and the first webpage differ in at least one of the following: protocol, domain name, and port. In some embodiments, the protocol of the second webpage is different from that of the first webpage. Exemplarily, the protocol of the first webpage is protocol 1, the protocol of the second webpage is protocol 2, and protocol 1 and protocol 2 are different protocols. In some embodiments, the domain names of the second webpage and the first webpage are different. Exemplarily, the domain name of the first webpage is domain name A, the domain name of the second webpage is domain name B, and domain name A and domain name B are different domain names. In some embodiments, the ports of the second webpage and the first webpage are different. Exemplarily, the port of the first webpage is port a, the port of the second webpage is port b, and port a and port b are different ports.

[0080] Of course, the technical solution provided in the embodiment of the present application is completely applicable to the case of homologous web pages. That is, if the second web page and the first web page are homologous web pages, the technical solution provided in the embodiment of the present application can also be adopted. For specific technical details, refer to the explanation of other embodiments in the context, and no further description is given.

[0081] The first web page and the second web page are described below in an exemplary manner in conjunction with a specific application scenario.

[0082] In one application scenario, the application is a video conferencing application, the first webpage is a conference function ordering webpage, and the second webpage is an order range selection webpage. Figure 7As shown, the first webpage 700 is a conference function ordering webpage, and the second webpage 701 is an order range selection webpage. In response to a click operation on the control 702 on the first webpage 700, the second webpage 701 is opened. Exemplarily, the domain name of the first webpage 700 is domain name A, and the domain name of the second webpage is domain name B.

[0083] For example, users can choose the quantity to be purchased on the conference function ordering webpage according to the needs of the enterprise, including three modes: enterprise-wide purchase, specified range, and custom quantity. The specified range mode requires opening a secondary page and selecting a specified node range (user, department, label). After selection, the homepage will calculate the final order price based on the selected node range. After selecting a node in the secondary page, the selected node needs to be displayed in real time on the homepage. That is, the web page data of the second webpage is displayed.

[0084] In the related art, the two web pages are not homologous, the front-end storage cannot communicate with each other, and data transmission communication cannot be performed directly. However, the present application uses the first sub-web page as an intermediate medium, so that the home page and the secondary page can communicate with each other.

[0085] In an application scenario, the application is a video application, the first webpage is a video playback webpage, and the second webpage is a friend sharing selection webpage.

[0086] Exemplarily, a user can choose to share with different friends on the video playback webpage of a video application. Exemplarily, when choosing to share with friends of other social software, it is necessary to open a friend sharing selection interface, where the friend sharing selection interface displays the friend accounts in the social application. Exemplarily, after selecting a friend to share with on the friend sharing selection interface, the friend account will be sent to the video playback webpage and displayed on the video playback webpage. The video playback webpage further shares the currently playing video with friend accounts in other social applications.

[0087] In one application scenario, the application is a novel reading application, the first webpage is a bookshelf webpage, and the second webpage is a book storage selection webpage.

[0088] Exemplarily, a user can select a resource library to store on the bookshelf webpage of a novel reading application. Exemplarily, the novel resources in different resource libraries are different. Exemplarily, when a first resource library is selected and a book storage selection webpage corresponding to the first resource library is opened, the book storage selection page displays the novel resources owned by the first resource library. Exemplarily, after selecting a novel resource to be stored on the book storage selection webpage, the novel resource will be sent to the bookshelf webpage and displayed on the bookshelf webpage. Exemplarily, the bookshelf webpage displays the homepage of the newly stored novel resource.

[0089] Of course, the application scenarios involved in the embodiments of the present application are not limited to the above three.

[0090] In some embodiments, the web page data is data related to the second web page. Exemplarily, the web page data includes interactive data obtained in response to the user's operation. Exemplarily, the web page data includes data displayed on the second web page from beginning to end without user operation. Exemplarily, if the second web page is an order range selection web page, the interactive data is the selected order range or node range, including selected users, departments, tags, etc. At this time, the interactive data is also called node data. Exemplarily, if the second web page is a web page for selecting friends to share, the interactive data is the selected friend account. Exemplarily, if the second web page is a web page for selecting books for storage, the interactive data is the selected book (such as a novel) resource that you want to store.

[0091] In some embodiments, since the first sub-webpage and the second webpage are webpages of the same origin, the first sub-webpage and the second webpage can communicate with each other.

[0092] In some embodiments, the communication method between web pages of the same origin (ie, the communication method between the first sub-web page and the second web page) includes at least one of the following.

[0093] The first one is LocalStorage and Storage events. LocalStorage is a local storage method commonly used on the front end, and it follows the same-origin policy. When the data in LocalStorage changes, a storage event is triggered. With this feature, two web pages of the same origin can communicate by paying attention to storage events. Send data: In one web page, use the localStorage.setItem method to write data to LocalStorage. Receive data: In another web page, receive notifications of data changes by paying attention to storage events. When the data in LocalStorage changes, a storage event is triggered, and the event object contains the changed key (key), old value (oldValue), and new value (newValue).

[0094] The second type is Broadcast Channel. Broadcast Channel API (Application Programming Interface) provides a channel for creating a channel that can be used to broadcast messages. When all web pages pay attention to the messages of the same channel, the message sent by one of the web pages through it will be received by all other web pages. Create a channel: Use new BroadcastChannel(name) to create a new BroadcastChannel object, where name is the name of the channel. Send a message: Send a message by calling the postMessage method of the Broadcast Channel object. Receive a message: Receive a message by paying attention to the message event of the Broadcast Channel object.

[0095] The third type is Shared Worker. Shared Worker is a type of Web Worker. It can be used by multiple windows, tabs, and iframes, but it must be ensured that these tabs are of the same origin. Shared Worker can realize data sharing and communicate with multiple web pages through a message passing mechanism. Create a Shared Worker: Use newSharedWorker(url) to create a new Shared Worker, where url is the URL (Uniform Resource Locator) of the Shared Worker script. Send messages: Send messages through the postMessage method of the Shared Worker's port object. Receive messages: Receive messages by paying attention to the message event of the Shared Worker's port object. At the same time, you need to pay attention to the onmessage event in the Shared Worker script to handle the received messages.

[0096] The fourth one is IndexedDB. IndexedDB is a low-level API for clients to store large amounts of structured data, including files / binary data. Although it is mainly used to store data, it can also achieve cross-web page communication through polling. Storing data: Use the IndexedDB API to store data in the database. Receiving data: In other web pages, poll the database to get the latest data changes. Although this method can achieve communication, it is inefficient and is not recommended for real-time communication scenarios.

[0097] The fifth method is cookies and front-end polling. Although cookies are mainly used to transfer data between the server and the client, cross-web page communication can also be achieved through front-end polling. However, this method is also inefficient and is susceptible to browser restrictions on the number and size of cookies. Set cookies: Set cookies in one web page. Read cookies: Read the value of cookies through JavaScript in other web pages. Front-end polling: Use methods such as setInterval to continuously check whether the value of cookies has changed, thereby achieving cross-web page communication.

[0098] Step 340: The first sub-webpage sends webpage data to the first webpage.

[0099] In some embodiments, when the first web page is in a display state, the first sub-web page sends web page data to the first web page.

[0100] In some embodiments, the first webpage being in a display state means that the first webpage is visible. In some embodiments, when the first webpage is in a non-display state, the first webpage is not visible.

[0101] In some embodiments, the first webpage is in an open state (also referred to as a running state), and the first webpage is visible on the user interface, and it is considered that the first webpage is in a display state.

[0102] In some embodiments, if the first webpage is in an open state but is not visible in the user interface, it is considered that the first webpage is in a non-display state. At this time, the first webpage can run in the background and is not displayed on the user interface.

[0103] In some embodiments, when it is identified that the first web page is in a display state, the first web page receives web page data of the second web page sent from the first sub-web page, and displays the web page data of the second web page.

[0104] In some embodiments, the first sub-webpage, as an embedded webpage, can communicate with its parent webpage (ie, the first webpage).

[0105] In some embodiments, the first webpage can pass data to the first sub-webpage by changing the hash value or query string in the src attribute of the iframe. The first sub-webpage can use the setInterval method to follow these changes and update its content or execute corresponding logic accordingly.

[0106] In some embodiments, a proxy iframe is used. The proxy iframe is located under the same domain name as the first webpage, so it can communicate with the first webpage. The first sub-webpage first sends data to the proxy iframe, and then the proxy iframe forwards the data to the first webpage.

[0107] In some embodiments, the postMessage API of HTML5 is used. This API allows secure communication between windows of different sources. Both the first webpage and the first sub-webpage can receive messages sent by the other party by paying attention to the message event.

[0108] In some embodiments, the first web page sends a message to the first sub-web page: iframeElement.contentWindow.postMessage(message,targetOrigin). The first sub-web page receives the message: add window.addEventListener('message',receiveMessage,false); function in the JavaScript of the first sub-web page, where the receiveMessage function is used to process the received message. The first sub-web page sends a message to the first web page: window.parent.postMessage(message,targetOrigin). The first web page receives the message: add a corresponding message event listener in the JavaScript of the first web page.

[0109] In some embodiments, the first sub-webpage sends webpage data to the first webpage by using a cross-document message transmission (postMessage) method.

[0110] In some embodiments, the postMessage method can be used to send a message to another window (or iframe, worker, etc.). The method receives two parameters: the first parameter is the message to be sent, which can be a string, object, etc. The second parameter is the origin of the target window, which is used to specify which windows the message can be sent to. The message will only be sent if the protocol, host address, and port of the target window are completely matched.

[0111] In some embodiments, the window receiving the message needs to pay attention to the message event. When a message is received, the event is triggered and an event object is passed to the event processing function. The object contains the following properties: data: the content of the message sent. origin: the source of the window sending the message. source: the proxy of the window object of the window sending the message, through which the message can be sent to the sender.

[0112] The technical solution provided in the embodiment of the present application ensures mutual communication between the first sub-webpage and the first webpage through cross-document message transmission, and ensures communication efficiency and communication quality.

[0113] Compared with the related art, the technical solution provided by the embodiment of the present application broadcasts the message to all web pages that pay attention to the communication channel, introduces the first sub-web page as an intermediate medium, realizes cross-web page communication between any two web pages of different sources, and has good versatility. Specifically, the first sub-web page is created by a component embedded in the first web page, so the first sub-web page and the first web page can communicate with each other. When the first sub-web page is created by the component embedded in the first web page, the created first sub-web page and the second web page are web pages of the same source, so the first sub-web page and the second web page can communicate with each other. Since the first sub-web page and the first web page can communicate with each other, the first sub-web page and the second web page can communicate with each other, that is, the mutual communication between the first web page and the second web page is indirectly realized. In the case where the web page data of the second web page changes, the second web page sends the web page data of the second web page to the first sub-web page. When displaying the first web page, the first web page receives the web page data of the second web page sent by the first sub-web page. Based on this, cross-web page communication between the first web page and the second web page of non-same source with the first sub-web page as the intermediate medium is realized, which is suitable for any two web pages of different sources that need to communicate, and has good versatility.

[0114] Please refer to Figure 4 , which shows a flow chart of a cross-webpage communication method provided by another embodiment of the present application. The execution subject of the method may be the terminal device 10 introduced above, such as the execution subject of each step is the client of the target application mentioned in the above embodiment. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as the "terminal device". The method may include at least one of the following steps (410-450).

[0115] Step 410, when the first web page is in an open state, run the first sub-web page, the first web page includes a portal control, the portal control is used to open a second web page that is not from the same source as the first web page, the first sub-web page is created by a component embedded in the first web page, and the first sub-web page and the second web page are from the same source.

[0116] Step 420, in response to the operation on the entry control, open the second web page.

[0117] In some embodiments, the second web page stores data information in a data file, the data information is used to indicate web page data, and the data file is a file shared by the second web page and the same-origin web page of the second web page on the terminal device.

[0118] In some embodiments, the data file is a file shared by the first sub-webpage and the webpage of the same origin as the first sub-webpage, and the data information is stored in the data file by the second webpage, and the data information is used to indicate the webpage data.

[0119] In some embodiments, the data file is a file shared by the second webpage and the webpage of the same source as the second webpage on the terminal device. Exemplarily, webpages with the same domain name can share the data file. Exemplarily, webpages with the same port can share the data file. Exemplarily, webpages with the same protocol can share the data file.

[0120] In some embodiments, the first sub-webpage and the second webpage are homologous webpages with the same domain name, and the first sub-webpage and the second webpage share the data file. Exemplarily, the data file is stored in the terminal device, and both the first sub-webpage and the second webpage can read the data file.

[0121] Exemplarily, the data file is a Cookie. In some embodiments, the data file is a front-end storage file of a web page.

[0122] Exemplarily, the data information is information used to indicate web page data. Exemplarily, the data information may be the web page data directly, the data information may also be identification information of the web page data, or may be a storage address of the web page data. Exemplarily, after knowing the data information, the web page data may be directly or indirectly acquired.

[0123] The technical solution provided in the embodiment of the present application uses the data file shared by the second web page and the homologous web page of the second web page on the terminal device as an intermediate storage medium to establish a communication bridge between the second web page and the first sub-web page, which is conducive to ensuring the cross-web page communication to be achieved in the present application.

[0124] In some embodiments, the second web page sends the web page data to the server of the second web page; the second web page receives identification information sent by the server, and the identification information is used to identify the web page data stored in the server; the second web page stores the identification information as data information in a data file.

[0125] In some embodiments, the data information is identification information, which is sent to the second web page by the server of the second web page after storing the web page data sent by the second web page, and is used to identify the web page data stored in the server.

[0126] In some embodiments, the second webpage may correspond to a backend server or may not correspond to a backend server, and this application does not limit this. Exemplarily, when the second webpage does not have a corresponding backend server, the server of the second webpage here is a server for implementing temporary storage, and does not refer to the backend server of the application (such as the backend server of the first webpage). Exemplarily, the server of the second webpage is a temporary storage server of the second webpage. Exemplarily, the temporary storage server of the second webpage is a server for implementing temporary storage of the second webpage. In the first way, the temporary storage server of the second webpage is configured in advance, and the temporary storage servers corresponding to different webpages are preconfigured. In the second way, the temporary storage server of the second webpage can also be found by the backend server of the application from multiple servers. The server is scheduled to be used as the temporary storage server of the second webpage. In the third way, the temporary storage server of the second webpage can also be found by the server of the first webpage from multiple servers. The idlest server, and the server is scheduled to be used as the temporary storage server of the second webpage. In a fourth manner, the temporary storage server of the second web page may also be a scheduling server (used to allocate temporary storage servers to web pages) that finds the most idle server from multiple servers and schedules the server to serve as the temporary storage server of the second web page.

[0127] In other embodiments, the second webpage corresponds to a backend server. In this case, the backend server of the second webpage can be directly used as the server of the second webpage mentioned in this application. Of course, the backend server of the second webpage can also be used as the server of the second webpage mentioned in this application. Exemplarily, when the backend server of the second webpage is not used as the server of the second webpage mentioned in this application, the temporary storage server of the second webpage is used as the server of the second webpage. Exemplarily, when the storage space of the backend server of the second webpage is greater than or equal to the third threshold, the backend server of the second webpage is used as the server of the second webpage mentioned in this application. Exemplarily, when the storage space of the backend server of the second webpage is greater than or equal to the third threshold, the temporary storage server of the second webpage (pre-configured or allocated in real time according to traffic conditions) is used as the server of the second webpage mentioned in this application. Exemplarily, the third threshold is a pre-configured value.

[0128] In some embodiments, when a temporary storage server for a second web page is allocated in real time, after the first sub-web page sends web page data to the first web page, the data related to the second web page stored in the temporary storage server for the second web page is cleared, and the temporary storage server for the second web page is considered to be an idle server, allowing temporary storage of other web pages.

[0129] Exemplarily, according to the second web page, the server of the second web page is configured. Exemplarily, according to the domain name of the second web page, the domain name of the second web page is pointed to the IP address (Internet Protocol Address) of the server. Exemplarily, if the domain name of the second web page is domain name B, domain name B points to the IP address of the server. Exemplarily, this process refers to associating a domain name with the IP address of a specific server so that the website or application hosted on the server can be accessed through the domain name. Specifically, when a user enters a domain name through a browser, the browser sends a request to the Domain Name System (Domain Name System, DNS) server to obtain the IP address corresponding to the domain name. The DNS server will look up the IP address corresponding to the domain name and return it to the browser. After the browser receives the IP address, it will send a request to the server corresponding to the IP address. After receiving the request, the server will process the request and return the corresponding web page content or other resources to the browser for display.

[0130] Exemplarily, since the second webpage and the first sub-webpage have the same domain name, the second webpage and the first sub-webpage can both directly access the server of the second webpage. Exemplarily, the second webpage stores the webpage in the server of the second webpage, and the first sub-webpage can obtain the server where the second webpage is stored from the server. Based on this, the present application realizes mutual communication between the first sub-webpage and the second webpage.

[0131] Exemplarily, the second web page stores the web page data in the server, and the server returns the identification information to the second web page. Exemplarily, the identification information is used to identify the web page data stored in the server. Exemplarily, in the server, the identification information is considered to be a key, and the web page data is considered to be a value, and the two constitute a key-value pair. Exemplarily, a key is an identifier used to uniquely identify a data item or record. In the server, a key is usually a string used to find or access a corresponding value in a data structure. The value is the content of the data item or record associated with the key. In the server, a value can be a data type such as a string, a number, a list, a hash table, a set, etc., depending on the database or data storage system used.

[0132] Exemplarily, the key-value pair allows the storage of any type of data, and does not require the data structure to be defined in advance. This makes the key-value pair very suitable for storing and accessing structured, semi-structured, and unstructured data. Exemplarily, when the amount of web page data is greater than or equal to the first threshold, the second web page sends the web page data to the server of the second web page; the second web page receives the identification information sent by the server, and the identification information is used to identify the web page data stored in the server; the second web page stores the identification information as data information in the data file. At this time, the data file only stores the identification information of the web page data.

[0133] Exemplarily, the identification information is used to identify the web page data stored in the server. In some embodiments, the identification information is a key of the web page data. Exemplarily, the server is Node (Node.js). In Node.js, when you want to temporarily store data, you usually use a key to uniquely identify the stored data item. This key can be any string as long as it is unique in the storage system.

[0134] Exemplarily, the identification information about the second webpage returned by the server to the second webpage is directly used as data stored in the data file of the second webpage, and is shared by the second webpage and the first sub-webpage.

[0135] Exemplarily, only one identification information is stored in the data file. That is, no matter how the web page data changes, there is always only one identification information in the data file. Exemplarily, the identification information in the data file is constantly changing as the web page data of the second web page changes. Exemplarily, when the web page data of the second web page changes, the second web page sends the changed web page data of the second web page to the server for storage again, and the server returns the changed identification information. Exemplarily, the second web page replaces the identification information before the change in the data file with the changed identification information. Exemplarily, the second web page deletes the identification information before the change in the data file and only retains the identification information after the change. In this way, considering that the storage space of the front-end storage is generally small, it is impossible to store more content in the data file, so only one identification information is used to store the data file. It is conducive to ensuring storage efficiency and avoiding the occurrence of insufficient storage space.

[0136] In some embodiments, Figure 6As shown, by using cookies and iframe as bridges, Node stores temporary data to achieve communication between two non-homologous web pages, which is generally divided into the following three parts: Node's temporary storage (storing web page data), homologous communication between the iframe sub-web page and the secondary page 601 (communication between the first sub-web page and the second web page), and non-homologous communication between the iframe sub-web page and the home page 600 (communication between the first sub-web page and the first web page).

[0137] In some embodiments, the second web page stores the web page data as data information in a data file. In some embodiments, the data information is web page data.

[0138] Exemplarily, in addition to using a server for temporary storage to store web page data (i.e., a method of implementing storage through a server), local storage can also be used to implement the storage of web page data. Exemplarily, local storage here refers to a storage method that does not require the use of a server to implement storage. Exemplarily, local storage is any method of storing data on a user's local device. Specifically, the local storage method includes at least one of the following: storage through a file system, storage through a database, and storage through a storage mechanism provided by a browser (i.e., front-end storage). Among them, storage through a file system refers to permanent storage of files and application data through storage media such as a hard disk or SSD on a user's device. Among them, storage through a database refers to storing structured data through a database (such as SQLite). Among them, front-end storage allows web applications to store data in the user's browser. Front-end storage includes Web Storage (localStorage and sessionStorage), IndexedDB, Cookies, etc., which store data in the user's browser sandbox environment. Exemplarily, the data file mentioned in this application is used to implement the above-mentioned local storage. Exemplarily, the data file is a Cookie.

[0139] The technical solution provided by the embodiment of the present application, when a data file is used as an intermediate storage medium, has two forms for the data content stored in the data file. In one case, the web page data of the second web page is directly stored as data information in the data file. In another case, the identification information of the web page data is stored as data information in the data file. The present application provides at least two storage forms, reflecting the diversity and flexibility of data storage forms.

[0140] Exemplarily, when the amount of the webpage data is less than the first threshold, the second webpage stores the webpage data as data information in the data file. At this time, the webpage data is directly stored in the data file.

[0141] In some embodiments, when the second webpage obtains the webpage data of the second webpage, the second webpage determines which storage method to use based on the data volume of the webpage data. Exemplarily, if the second webpage determines that the data volume of the webpage data is less than the first threshold, the webpage data is stored in a manner that the data file directly stores the webpage data. If the second webpage determines that the data volume of the webpage data is greater than or equal to the first threshold, the webpage data is stored in a manner that the server is used to store the webpage data and the data file is used to store the representation information.

[0142] Exemplarily, the second webpage adopts a full storage mode when storing the webpage data in the data file. Exemplarily, each time the webpage data is stored, the webpage data is completely stored in the data file.

[0143] Exemplarily, the second webpage adopts an incremental storage method when storing webpage data in the data file. Exemplarily, each time the webpage data is stored, the webpage data is compared with the existing data in the data file, and the incremental data generated is stored in the data file.

[0144] In some embodiments, when the amount of webpage data is greater than or equal to the first threshold, the data information stored in the data file is identification information. Exemplarily, when the amount of webpage data is greater than or equal to the first threshold, the data information is identification information.

[0145] In some embodiments, when the amount of webpage data is less than a first threshold, the data information stored in the data file is webpage data. Exemplarily, when the amount of webpage data is less than a first threshold, the data information is webpage data.

[0146] In some embodiments, a server is used to store web page data. Exemplarily, web page data is stored through Node server storage. Exemplarily, the node data selected by the secondary page may have a large amount of data, and the front-end storage cannot store too much data. Exemplarily, the server interface (that is, the mall Node interface) can only be called by the mall front-end web page deployed under domain name B. Exemplarily, the second web page can call the server interface to store the web page data in the server. In some embodiments, Node is introduced as a temporary storage to store user interaction data. After the storage interface is called by the secondary page, the key corresponding to the temporary storage is returned and stored in the secondary page front-end storage.

[0147] Of course, the Node storage involved in the embodiments of the present application not only includes the above-mentioned Node server storage, but can also be expressed as Node local storage. That is, there are three storage methods in the present application. The first is to store web page data through the server of the second web page (such as Node server storage). The second is to store web page data through data files. The third is to store web page data through Node local storage.

[0148] For the explanation of the first and second types, please refer to the above embodiments, which will not be repeated here. For the third type, Node local storage, when the terminal device where the first webpage and the second webpage are located is the same terminal device, Node local storage can be directly used without using Node server storage. On the contrary, if the terminal devices where the first webpage and the second webpage are located are different terminal devices, Node server storage is required to realize webpage data sharing.

[0149] In some embodiments, Node local storage generally refers to a storage method in which data is stored on a local computer running a Node.js application in a Node.js environment. In Node.js, local storage can be implemented mainly in the following ways.

[0150] The first is the file system (fs). Node.js provides the fs module, which allows developers to programmatically access and operate the local file system. The fs module can be used to read and write files, create directories, delete files, etc., so as to save data on the local disk.

[0151] The second is memory storage. Node.js applications can store data in memory (for example, using variables, arrays, or objects) for temporary storage.

[0152] The third type is database. Although databases are usually associated with network storage (for example, databases such as MySQL and MongoDB are usually deployed on servers), you can also install and run database instances on your local computer. In this way, you can access and store data in Node.js applications through database client libraries (such as mongoose for MongoDB, mysql for MySQL, etc.).

[0153] The fourth type is third-party modules. In addition to the fs module and memory storage, there are some third-party Node.js modules that provide local storage functions. For example, node-localstorage is a Node.js module that simulates the browser LocalStorage API, which allows data to be stored in the form of key-value pairs in the Node.js environment.

[0154] In the technical solution provided in the embodiment of the present application, when the data volume of the web page data is greater than or equal to the first threshold value, the identification information is stored as data information in the data file. When the data volume of the web page data is less than the first threshold value, the web page data is directly stored as data information in the data file. Considering that the local storage of the web page data is realized through the data file, and the storage space of the local storage is relatively small, different storage forms are used for web page data of different data volumes, so as to avoid the occurrence of storage errors caused by insufficient storage space.

[0155] Step 430: When the second webpage is in an open state, the first sub-webpage obtains data information from the data file.

[0156] In some embodiments, as can be seen from the above, since the data file is shared by the second webpage and the webpage of the same origin as the second webpage, the first sub-webpage can also directly obtain the data file. Further, the first sub-webpage can obtain data information from the data file.

[0157] In some embodiments, when the web page data is directly stored in the data file, the first sub-web page directly obtains the web page data from the data file.

[0158] In some embodiments, when the identification information of the web page data is directly stored in the data file, the first sub-webpage needs to obtain the identification information from the data file. Further, the first sub-webpage obtains the web page data from the server based on the identification information. Exemplarily, since the domain name of the second webpage points to the IP address of the server, and the first sub-webpage and the second webpage have the same origin and the same domain name, the first sub-webpage can also directly access the server to obtain the web page data from the server.

[0159] The technical solution provided by the embodiment of the present application, when the identification information is stored in the data file, a Node (server) is used to temporarily store the web page data. The web page data with a large amount of data is stored in the server, and the identification information with a small amount of data returned by the server is stored in the data file of the terminal device. The server is combined with the front-end storage method to realize the storage of web page data with a large amount of data.

[0160] In some embodiments, the first sub-webpage can actively obtain data information from the data file. Of course, in other embodiments, the first sub-webpage can also passively obtain data information from the data file.

[0161] For example, if the first sub-webpage actively obtains data information from the data file, the first sub-webpage can always pay attention to the data file, and when the data file changes, it means that the webpage data has changed. For example, when the data file changes, the first sub-webpage can pay attention to the change in time and obtain data information from the data file.

[0162] Exemplarily, if the first sub-page passively obtains data information from a data file, the first page may send a query message to the first sub-page to inquire whether the data file has changed. Exemplarily, after receiving the query message, the first sub-page queries the data file to determine whether it has changed.

[0163] For example, if the first sub-webpage passively obtains data information from the data file, the second webpage may also send a prompt message to the first webpage to prompt the change. For example, after receiving the prompt message, the first sub-webpage can know that the data file has changed. After receiving the prompt message, it is no longer necessary to determine whether the data file has changed, and the data information can be directly obtained from the data file.

[0164] The technical solution provided by the embodiment of the present application has two opportunities for the first sub-webpage to obtain data information from the data file. One is that the first webpage actively sends an inquiry message to the first sub-webpage to inquire the first sub-webpage whether the data information has changed. The other is that the second webpage actively reports a prompt message to the first sub-webpage to prompt the first sub-webpage that the data information has changed. Through these two methods, the first sub-webpage can be triggered to sense whether the data information has changed, thereby further executing the step of obtaining the data information. This reflects the diversity of the opportunities for the first sub-webpage to obtain data information from the data file, and also reflects the flexibility of the implementation method of cross-webpage communication.

[0165] Specifically, for the timing of obtaining data information from the data file mentioned in step 430, there are the following ways.

[0166] In the first method, the first web page needs to actively send inquiry information to the first sub-web page to determine whether the data information in the data file is changed.

[0167] In some embodiments, the first web page sends a query message to the first sub-web page, where the query message is used to inquire whether the data information in the data file is changed.

[0168] In some embodiments, when the first sub-webpage queries the data file based on the query information and determines that the data information has changed, the first sub-webpage obtains the data information from the data file.

[0169] In some embodiments, since the first sub-webpage is a webpage created by an embedded component in the first webpage, the first sub-webpage and the first webpage can communicate with each other. Exemplarily, the first webpage can send query information to the first sub-webpage.

[0170] In some embodiments, for the first web page and the second web page on the user interface, there are two display types, including the first display type and the second display type described below.

[0171] For example, the first display type allows only one web page to be displayed at a time, that is, after displaying the second web page, the first web page is no longer displayed. Alternatively, when returning from the second web page to the first web page, the first web page is displayed, and the second web page is no longer displayed. That is, at the same time, only one web page is displayed between the first web page and the second web page.

[0172] Exemplarily, the second display type allows two or more web pages to be displayed simultaneously, that is, after displaying the second web page, the first web page is kept displayed. Or, when returning to the first web page from the second web page, the first web page is displayed and the second web page is kept displayed. That is, at the same time, the first web page and the second web page can be displayed simultaneously.

[0173] In some embodiments, for the first display type, after the second webpage is opened, if the first webpage is redisplayed, the first webpage sends a query message to the first sub-webpage when the first webpage is redisplayed.

[0174] In some embodiments, when the second webpage is in an opened state and the first webpage is not visible, when the first webpage is redisplayed based on the second webpage, the first webpage sends a query message to the first sub-webpage.

[0175] In some embodiments, when the second webpage is opened based on the first webpage and the first webpage is not visible after the second webpage is displayed, the first webpage sends query information to the first sub-webpage when redisplaying the first webpage based on the second webpage.

[0176] Exemplarily, when the second webpage is opened based on the first webpage, and the first webpage is not visible after the second webpage is displayed, the first display type is described. Exemplarily, the first webpage is redisplayed based on the second webpage, that is, returning from the second webpage to the first webpage, or directly switching from the second webpage to the first webpage.

[0177] In some embodiments, taking the application as a video conferencing application as an example, the enterprise WeChat mall involved in the video conferencing application is implemented across multiple terminals such as IOS, Android, Mac, Win, and management terminals, and can be generally divided into interactions on three platforms: mobile terminal, desktop terminal, and management terminal.

[0178] In some embodiments, the mobile terminal: jumps from the primary page to the secondary page by creating a new webview (i.e., the second webpage mentioned in this application) on top of the current webview (i.e., the first webpage mentioned in this application), and there is only one webpage from the user's perspective. Exemplarily, the mobile terminal refers to an application or website designed for mobile devices (such as smartphones and tablets).

[0179] In some embodiments, on the desktop side: another new webview is opened (i.e., the second webpage mentioned in the present application), and the two webviews on the desktop side (i.e., the first webpage and the second webpage mentioned in the present application) exist simultaneously and are interactive. Exemplarily, the desktop side refers to an application or software designed for a traditional computer (such as a desktop computer or a laptop computer).

[0180] In some embodiments, the management end: in a hashing manner, there is only one web page (ie, the first web page or the second web page mentioned in this application) from the user's perspective. Exemplarily, the management end is a system or platform for monitoring and managing multiple clients or devices.

[0181] In some embodiments, the interactions of the three platforms can be classified into two types (corresponding to the first display type and the second display type mentioned above), and the communication mechanism provided by the embodiment of the present application is compatible with both situations. The overall scheme is roughly the same, and it only needs to be distinguished when querying whether the cookie has changed.

[0182] In some embodiments, for the mobile terminal and the management terminal, when the secondary page is opened, the home page is hidden. When the home page is visible, the iframe sub-page is notified to start querying whether the key in the current custom cookie has changed, such as Fig.11 As shown. For example, Fig.11 The cross-webpage communication method shown includes at least one of the following steps S1 to S14.

[0183] Step S1, enter the web page.

[0184] In some embodiments, a user enters a first web page.

[0185] Step S2, initialization creation.

[0186] In some embodiments, the home page initializes and creates an iframe sub-page. Exemplarily, the home page creates an iframe sub-page through an iframe component.

[0187] Step S3, click to enter the secondary page.

[0188] In some embodiments, clicking the first control on the home page enters the secondary page.

[0189] Step S4, select the node and save it.

[0190] In some embodiments, the user selects a node, and the secondary page saves the node selected by the user to obtain node data. The node data can also be considered as the webpage data of the second webpage.

[0191] Step S5, RPC (Remote Procedure Call) call.

[0192] In some embodiments, data interaction is achieved between Node and the background of the application through RPC calls.

[0193] Step S7: temporarily store the node data.

[0194] In some embodiments, the secondary page stores the node data in the Node.

[0195] Step S8, the key value currently temporarily stored.

[0196] In some embodiments, Node returns the currently temporarily stored key value to the secondary page.

[0197] Step S9, set the latest key to the cookie.

[0198] In some embodiments, the secondary page stores the latest key in a cookie.

[0199] Step S10, click to return to the home page.

[0200] In some embodiments, when returning to the home page from the secondary page, it is considered to be the first display type mentioned above, that is, the secondary page and the home page cannot be displayed at the same time.

[0201] Step S11, determining whether the cookie has changed.

[0202] In some embodiments, when returning to the home page from the secondary page, the home page sends a query message to the iframe sub-page to inquire whether the cookie has changed, that is, to inquire whether the key stored in the cookie has changed.

[0203] Step S12, when the cookie changes, take out the key and read the cache in the Node.

[0204] In some embodiments, when the cookie changes, the iframe sub-page obtains the key from the cookie. Exemplarily, the iframe sub-page obtains the node data from the Node according to the key.

[0205] Step S13, returning the node data.

[0206] In some embodiments, Node sends the node data to the iframe sub-webpage.

[0207] Step S14, returning the node data.

[0208] In some embodiments, the iframe sub-page sends the node data to the home page. In some embodiments, the node data is displayed on the home page.

[0209] In some embodiments, for the second display type, when the second web page is opened based on the first web page and the first web page remains displayed, the first web page sends inquiry information to the first sub-web page in the form of polling. Exemplarily, the polling form means that the first web page sends an inquiry information to the first sub-web page once every interval of the second threshold. Exemplarily, starting from opening the second web page, or starting from performing an operation on the second web page to obtain interactive data, the first web page sends an inquiry information to the first sub-web page once every interval of the second threshold.

[0210] In some embodiments, when the second web page is in an opened state and the first web page remains displayed, the first web page sends inquiry information to the first sub-web page in a polling form.

[0211] In some embodiments, when the second web page is opened based on the first web page and the first web page remains displayed, the first web page sends inquiry information to the first sub-web page in the form of polling.

[0212] Exemplarily, when the second webpage is opened based on the first webpage and the first webpage remains displayed, the second display type is described. Exemplarily, after the second webpage is opened, the first webpage that remains displayed begins to send inquiry information to the first sub-webpage in the form of polling.

[0213] In some embodiments, for the desktop, the secondary page and the home page are opened at the same time, and the home page needs to poll in real time whether the current custom cookie has changed to determine whether the interaction data generated by the user is refreshed, such as Fig.12 As shown. For example, Fig.12 The cross-webpage communication method shown includes at least one of the following steps P1 to P14.

[0214] Step P1, enter the web page.

[0215] In some embodiments, a user enters a first web page.

[0216] Step P2, initialization creation.

[0217] In some embodiments, the home page initializes and creates an iframe sub-page. Exemplarily, the home page creates an iframe sub-page through an iframe component.

[0218] Step P3, click to enter the secondary page.

[0219] In some embodiments, clicking the first control on the home page enters the secondary page.

[0220] Step P4, select the node and save it.

[0221] In some embodiments, the user selects a node, and the secondary page saves the node selected by the user to obtain node data. The node data can also be considered as the webpage data of the second webpage.

[0222] Step P5, RPC call.

[0223] In some embodiments, data interaction is achieved between Node and the background of the application through RPC calls.

[0224] Step P7, temporarily storing node data.

[0225] In some embodiments, the secondary page stores the node data in the Node.

[0226] Step P8, the key value currently temporarily stored.

[0227] In some embodiments, Node returns the currently temporarily stored key value to the secondary page.

[0228] Step P9, set the latest key to the cookie.

[0229] In some embodiments, the secondary page stores the latest key in a cookie.

[0230] Step P10, click to return to the home page.

[0231] In some embodiments, when returning to the home page from the secondary page, it is considered to be the second display type mentioned above, that is, the secondary page and the home page are displayed at the same time.

[0232] Step P11, polling whether the cookie has changed.

[0233] In some embodiments, the home page sends a query message to the iframe sub-page in a polling form to inquire whether the cookie has changed, that is, to inquire whether the key stored in the cookie has changed.

[0234] Step P12, when the cookie changes, take out the key and read the cache in Node.

[0235] In some embodiments, when the cookie changes, the iframe sub-page obtains the key from the cookie. Exemplarily, the iframe sub-page obtains the node data from the Node according to the key.

[0236] Step P13, return node data.

[0237] In some embodiments, Node sends the node data to the iframe sub-webpage.

[0238] Step P14, return node data.

[0239] In some embodiments, the iframe sub-page sends the node data to the home page. In some embodiments, the node data is displayed on the home page.

[0240] In some embodiments, for the mobile terminal and the management terminal, the corresponding display type is the first display type mentioned above. In some embodiments, the corresponding display type is the second display type mentioned above.

[0241] In the second method, the second webpage needs to send a prompt message to the first sub-webpage to inform the first sub-webpage that a storage event occurs or data information is changed.

[0242] In some embodiments, the second webpage sends a prompt message to the first sub-webpage, where the prompt message is used to indicate that the data information in the data file has changed, or the second webpage generates a storage event for the data information.

[0243] In some embodiments, the first sub-webpage receives prompt information sent by the second webpage, where the prompt information is used to indicate that data information in the data file has changed, or that the second webpage has generated a storage event for the data information.

[0244] Exemplarily, when the second webpage stores webpage data, a storage event is triggered. Exemplarily, the second webpage sends prompt information to the first sub-webpage based on the storage event.

[0245] Exemplarily, when the second webpage stores data information in the data file, if the data information changes, the second webpage sends a prompt message to the first sub-webpage.

[0246] Exemplarily, since the second webpage and the first sub-webpage are webpages of the same origin, the second webpage and the first sub-webpage can communicate with each other. Therefore, the second webpage can send prompt information to the first sub-webpage.

[0247] Exemplarily, there is no limitation on the specific type of the prompt information. Exemplarily, the prompt information may be an identifier agreed upon by the second webpage and the first sub-webpage. Exemplarily, the prompt information may be a specific numerical value, symbol or graphic, etc.

[0248] In some embodiments, after receiving the prompt information, the first sub-webpage obtains the data information from the data file.

[0249] For example, when the first sub-webpage receives the prompt information, the first sub-webpage can sense that the data information in the data file has changed, or the second webpage has generated a storage event for the data information. Whether the data information in the data file has changed, or the second webpage has generated a storage event for the data information, it means that the webpage data has changed, and the first sub-webpage needs to obtain the data information from the data file.

[0250] Exemplarily, in this case, for the first display type, when the first webpage is redisplayed, the first sub-webpage actively sends the webpage data acquired in advance to the first webpage, and the first webpage does not need to send query information to the first sub-webpage.

[0251] Exemplarily, in this case, for the second display type, while the first webpage is displayed, the first sub-webpage actively sends the acquired webpage data to the first webpage, without the first webpage polling and sending query information to the first sub-webpage.

[0252] In some embodiments, the iframe sub-page (i.e., the first sub-page) and the secondary page are interconnected through cookies. Therefore, cookies are used as front-end storage to store the key for temporary data storage. The iframe sub-page can sense the changes in the key value of the cookie of the secondary page.

[0253] The technical solution provided by the embodiment of the present application adopts different methods of sending inquiry information for two different display types, namely the first display type and the second display type mentioned above. For the first display type, namely when the first web page is not always displayed, when the first web page is opened again, the first web page sends inquiry information to the first sub-web page. For the second display type, namely when the first web page is always displayed, the first web page sends inquiry information to the first sub-web page in a polling manner. The present application adopts different methods of sending inquiry information for different display modes, so that the timing of obtaining web page data is also different. The present application is compatible with terminal devices for different display types of web pages, which is conducive to ensuring cross-web page communication.

[0254] Step 440: obtaining web page data from the first sub-web page based on the data information.

[0255] In some embodiments, when the data information is identification information, the first sub-webpage obtains the webpage data from the server according to the identification information.

[0256] Exemplarily, since the identification information indicates the web page data stored in the server, the identification information and the web page data form a one-to-one correspondence in the server. After obtaining the identification information of the web page data, the first sub-web page can obtain the web page data from the server according to the correspondence.

[0257] In some embodiments, when the data information is web page data, the web page data is directly obtained from the data file. In this case, step 440 does not need to be performed.

[0258] In some embodiments, the second web page stores data in localStorage or sessionStorage. Exemplarily, the first sub-web page pays attention to storage events to capture data changes. Exemplarily, when the first sub-web page pays attention to changes in the storage event, the first sub-web page receives the storage event and reads the web page data of the second web page stored therein. Exemplarily, after the storage event of storage is supported in the webview, the corresponding node data is stored in the secondary page. The storage event will be triggered in the iframe, and the node data can be directly read.

[0259] In some embodiments, a shared channel or a communication channel is established between the first sub-page and the second page. Exemplarily, after the second page obtains the web page data of the second page, it sends the web page data of the second page to the first sub-page through the shared channel or the communication channel. Exemplarily, the shared channel is BroadcastChannel. Exemplarily, after supporting BroadcastChannel in webview, a communication channel can be established between the secondary page and the iframe sub-page. After selecting the corresponding node data in the secondary page, the established channel can be used to pass the data to the iframe sub-page.

[0260] Step 450: The first sub-webpage sends webpage data to the first webpage.

[0261] In some embodiments, the sub-page (i.e., the first sub-page) under domain name B is opened in the iframe as part of the intermediate bridge. The interactive data generated by the secondary page is obtained from the Node layer by using the custom key on the Cookie, and the data is passed to the home page (i.e., the first page) by using postMessage.

[0262] The technical solution provided in the embodiment of the present application builds a bridge between web pages based on cookies and iframes, and cooperates with the temporary storage of Node to open up the communication between two non-homologous web pages. Specifically, Node temporary storage, non-homologous communication between the iframe embedded web page (first child web page) and the parent web page (first web page), and cookie communication between the iframe embedded web page (first child web page) and the homologous web page (second web page). After one of the web pages generates data, the data can be passed to another web page without being bound by the browser homology policy. And in the big data scenario, the data is stored in the Node temporary storage and will not be limited by the front-end storage size, and the data transmission communication can also be transmitted normally.

[0263] Please refer to Figure 5 , which shows a flow chart of a cross-webpage communication method provided by another embodiment of the present application. The execution subject of the method may be the terminal device 10 introduced above, such as the execution subject of each step is the client of the target application mentioned in the above embodiment. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as the "terminal device". The method may include at least one of the following steps (510-570).

[0264] Step 510, when the first web page is in an open state, run the first sub-web page, the first web page includes a portal control, the portal control is used to open a second web page that is not from the same source as the first web page, the first sub-web page is created by a component embedded in the first web page, and the first sub-web page and the second web page are from the same source.

[0265] Step 511, in response to the operation on the portal control, open the second web page.

[0266] Step 520: When the second webpage is in an open state, the first sub-webpage obtains webpage data of the second webpage.

[0267] Step 530: The first sub-webpage sends webpage data to the first webpage.

[0268] In some embodiments, there are two situations as follows. The first situation includes the following step 550, and the second situation includes the following step 570. In some embodiments, step 550 is performed for the mobile terminal and the management terminal. In some embodiments, step 570 is performed for the desktop terminal.

[0269] In some embodiments, when a second web page is opened based on a first web page, the second web page is displayed, and the first web page is not visible after the second web page is displayed.

[0270] In some embodiments, when the second web page is in an opened state, the first web page is not visible.

[0271] In some embodiments, this is the first display type, that is, only one web page is displayed at the same time. Exemplarily, when the second web page is opened from the first web page and displayed, the first web page is canceled. Exemplarily, when the first web page is returned from the second web page and displayed, the second web page is canceled.

[0272] In some embodiments, only one web page can be seen from the user's perspective at the same time. Exemplarily, when the second web page is opened and displayed from the first web page, the second web page is displayed on the upper layer of the first web page. Exemplarily, the first web page is considered to be hidden and displayed at this time, and the user cannot see it and is considered invisible. Exemplarily, when the first web page is returned from the second web page and displayed, the first web page is displayed on the upper layer of the second web page. Exemplarily, the second web page is considered to be hidden and displayed at this time, and the user cannot see it and is considered invisible.

[0273] Step 550: when switching back from the second web page to the first web page, redisplay the first web page, and the redisplayed first web page includes web page data.

[0274] In some embodiments, when the first web page is redisplayed, the first web page obtains the web page data of the second web page and displays it at a specified position on the first web page. Specifically, when the first web page is redisplayed, the first web page sends an inquiry message to the first sub-web page. When the first sub-web page determines that the data information in the data file has changed based on the inquiry message, the first sub-web page obtains the data information from the data file and further obtains the web page data. Exemplarily, the first sub-web page sends the obtained web page data to the first web page. Exemplarily, after the first web page obtains the web page data of the second web page, it displays the web page data of the second web page at the specified position on the first web page. Exemplarily, the specified position is the display position of the web page data of the second web page on the first web page pre-configured during the development process.

[0275] In some embodiments, for the mobile device, as Figure 8 shown, the first web page 801 and the second web page 802 cannot be simultaneously displayed on the user interface. Exemplarily, when the second web page 802 is opened based on the first web page 801, the second web page 802 is displayed on the user interface, while the first web page 801 is invisible (cancelled display or hidden display (such as being displayed below the second web page 802)). Exemplarily, when returning from the second web page 802 to the first web page 801, the first web page 801 is displayed on the user interface, while the second web page 802 is invisible (cancelled display or hidden display (such as being displayed below the first web page 801)). Exemplarily, in response to an operation on the first control 806 on the first web page 801, the second web page 802 is switched for display. Exemplarily, on the second web page 802, the user can select nodes by themselves as the member range for selecting renewal. For example, select node data (xx test) 803 and select node data (xx) 804. Exemplarily, other nodes can also be added in response to an operation on the add member control 805. Exemplarily, the node data (xx test) 803 and the node data (xx) 804 are the web page data of the second web page. Exemplarily, the second web page 802 sends the web page data to the first web page 801 through the first sub-web page. Exemplarily, after receiving the web page data, the first web page 801 displays the web page data 800 on the first web page 801.

[0276] In some embodiments, for the management terminal, as Fig.10As shown. Select a node in the secondary page, and when returning to the homepage, the selected result of the secondary page is displayed. Exemplarily, when the second web page 1002 is opened based on the first web page 1001, the second web page 1002 is displayed on the user interface, while the first web page 1001 is not visible (the display is canceled or hidden (such as displayed in the lower layer of the second web page 1002)). Exemplarily, when returning to the first web page 1001 from the second web page 1002, the first web page 1001 is displayed on the user interface, while the second web page 1002 is not visible (the display is canceled or hidden (such as displayed in the lower layer of the first web page 1001)).

[0277] The technical solution provided by the embodiment of the present application directly displays the webpage data of the second webpage on the redisplayed first webpage for the first display type. When the first webpage is redisplayed, the first webpage sends the query information to the first sub-webpage and further obtains the webpage data, which is conducive to reducing the number of cross-webpage communications, thereby reducing the cross-webpage communication cost. At the same time, since the first webpage is not always displayed, it can also reduce a certain display cost.

[0278] In some embodiments, when the second web page is opened based on the first web page, the first web page and the second web page are displayed simultaneously.

[0279] In some embodiments, while the second web page is already opened, the first web page remains displayed.

[0280] In some embodiments, this is the second display type, that is, at least two web pages can be displayed at the same time. Exemplarily, when the second web page is opened from the first web page and displayed, the first web page is kept displayed. Exemplarily, when the first web page is returned from the second web page and displayed, the second web page can be kept displayed or closed.

[0281] In some embodiments, only two web pages can be seen from the user's perspective at the same time. For example, when the second web page is opened and displayed from the first web page, the first web page and the second web page are displayed at different positions on the user interface, and there is no overlap between the two. For example, the display positions of the first web page and the second web page on the user interface can be preset in advance or adjusted by the user.

[0282] Step 570: After the first webpage acquires the webpage data, the webpage data is displayed on the first webpage.

[0283] In some embodiments, when the first web page and the second web page are displayed at the same time, the first web page obtains the web page data of the second web page and displays it at a specified location on the first web page. Specifically, when the first web page and the second web page are displayed at the same time, the first web page polls and sends query information to the first sub-web page. When the first sub-web page determines that the data information in the data file has changed based on the query information, the first sub-web page obtains the data information from the data file and further obtains the web page data. Exemplarily, the first sub-web page sends the obtained web page data to the first web page. Exemplarily, after the first web page obtains the web page data of the second web page, it displays the web page data of the second web page at a specified location on the first web page. Exemplarily, the specified location is the display location of the web page data of the second web page pre-configured during the development process on the first web page.

[0284] In some embodiments, for a desktop client, such as Fig. 9 As shown. The desktop terminal displays two webviews at the same time. After selecting the result on the secondary page, the home page needs to display the result of the secondary page webview in real time. Exemplarily, when the second webpage 902 is opened based on the first webpage 901, the first webpage 901 and the second webpage 902 are displayed on the user interface at the same time. Exemplarily, the first webpage 901 is displayed on the left side of the second webpage 902.

[0285] The technical solution provided in the embodiment of the present application, for the second display type, displays the web page data of the second web page on the first web page that remains displayed, that is, the first web page polls the first sub-web page to inquire whether the data file has changed, so that the web page data of the second web page can be obtained at the first time and displayed on the first web page in time, thereby improving the efficiency of cross-web page communication and helping to provide users with a better visual experience.

[0286] The technical solution provided by the embodiment of the present application builds a bridge between web pages based on cookies and iframes, and opens up the communication between two web pages with the temporary storage of Node. Regardless of whether the two web pages are deployed under the same domain name, the front-end web pages can use this solution to achieve communication between web pages.

[0287] Application scenario examples:

[0288] Combine the following Figure 13 to Figure 15 , an application scenario embodiment involved in this application is introduced.

[0289] In an application scenario, the application is a video conferencing application, the first webpage is a conference function ordering webpage, and the second webpage is an order range selection webpage. Fig.13A flowchart of a cross-webpage communication method provided by another embodiment of the present application is shown. The execution subject of the method may be the terminal device 10 described above, such as the execution subject of each step is the client of the target application mentioned in the above embodiment. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as the "terminal device". The method may include at least one of the following steps (1310-1330).

[0290] Step 1310, when the conference function ordering webpage is in an open state, run the first sub-webpage, the conference function ordering webpage includes an entry control, the entry control is used to open an order range selection webpage that has a different source from the first webpage, the first sub-webpage is created by a component embedded in the conference function ordering webpage, and the first sub-webpage and the order range selection webpage are of the same source.

[0291] Step 1311, in response to the operation on the entry control, open the order range selection web page.

[0292] Step 1320: When the order range selection webpage is in an open state, the first sub-webpage obtains webpage data of the order range selection webpage.

[0293] In some embodiments, the first sub-web page obtains data information from a data file. The data file is a file shared by the first sub-web page and the homologous web page of the first sub-web page. The data information is stored in the data file by the order range selection web page. The data information is used to indicate the web page data. The first sub-web page obtains the web page data based on the data information.

[0294] In some embodiments, the data information is identification information, which is sent to the order range selection webpage by the server of the order range selection webpage after storing the webpage data sent by the order range selection webpage, and the identification information is used to identify the webpage data stored in the server; or, the data information is webpage data.

[0295] In some embodiments, when the amount of web page data is greater than or equal to a first threshold, the data information is identification information; when the amount of web page data is less than the first threshold, the data information is web page data.

[0296] In some embodiments, when the data information is identification information, the first sub-webpage obtains the webpage data from the server according to the identification information.

[0297] In some embodiments, the conference function ordering webpage sends an inquiry message to the first sub-webpage, where the inquiry message is used to inquire whether the data information in the data file has been changed.

[0298] In some embodiments, when the first sub-webpage queries the data file based on the query information and determines that the data information has changed, the first sub-webpage obtains the data information from the data file.

[0299] In some embodiments, when the order range selection webpage is open and the conference function ordering webpage is not visible, when the conference function ordering webpage is redisplayed based on the order range selection webpage, the conference function ordering webpage sends an inquiry message to the first sub-webpage.

[0300] In some embodiments, when the order range selection webpage is in an open state and the conference function ordering webpage remains displayed, the conference function ordering webpage sends inquiry information to the first sub-webpage in the form of polling.

[0301] In some embodiments, the first sub-webpage receives prompt information sent by the order range selection webpage, where the prompt information is used to indicate that data information in the data file has changed, or that the order range selection webpage has generated a storage event for the data information.

[0302] In some embodiments, after receiving the prompt information, the first sub-webpage obtains the data information from the data file.

[0303] Step 1330: The first sub-webpage sends webpage data to the conference function ordering webpage.

[0304] In some embodiments, when the order range selection webpage is open, the conference function ordering webpage is not visible.

[0305] In some embodiments, when switching from the order range selection webpage back to the conference function ordering webpage, the conference function ordering webpage is redisplayed, and the redisplayed conference function ordering webpage includes the webpage data.

[0306] In some embodiments, when the order range selection webpage is already opened, the conference function ordering webpage remains displayed.

[0307] In some embodiments, after the conference function ordering webpage acquires the webpage data, the webpage data is displayed in the conference function ordering webpage.

[0308] In some embodiments, the component is an iframe, the first sub-webpage is a sub-webpage constructed by the iframe, and the first sub-webpage is not displayed.

[0309] In some embodiments, the first sub-webpage sends webpage data to the conference function ordering webpage by cross-document message transmission.

[0310] In some embodiments, the order range selection webpage is a subordinate webpage of the conference function ordering webpage.

[0311] The technical solution provided by the embodiment of the present application takes into account the limitations of the homology policy in the related art. In the present application, the first sub-webpage is introduced as an intermediate medium in the video conferencing application to realize cross-webpage communication between the conference function ordering webpage and the order range selection webpage of non-homologous origin. Specifically, the first sub-webpage is a sub-webpage created by a component embedded in the conference function ordering webpage, so the first sub-webpage and the conference function ordering webpage can communicate with each other. Moreover, when the first sub-webpage is created by the component embedded in the conference function ordering webpage, the created first sub-webpage and the order range selection webpage are homologous webpages, so the first sub-webpage and the order range selection webpage can communicate with each other. Based on this, cross-webpage communication between the conference function ordering webpage and the order range selection webpage of non-homologous origin with the first sub-webpage as the intermediate medium is realized.

[0312] In an application scenario, the application is a video application, the first webpage is a video playback webpage, and the second webpage is a friend sharing selection webpage. Fig.14 A flowchart of a cross-webpage communication method provided by another embodiment of the present application is shown. The execution subject of the method may be the terminal device 10 described above, such as the execution subject of each step is the client of the target application mentioned in the above embodiment. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as the "terminal device". The method may include at least one of the following steps (1410-1430).

[0313] Step 1410, when the video playback webpage is in an open state, run the first sub-webpage, the video playback webpage includes an entry control, the entry control is used to open a friend sharing selection webpage that has a different source from the video playback webpage, the first sub-webpage is created by a component embedded in the video playback webpage, and the first sub-webpage and the friend sharing selection webpage are the same source webpages.

[0314] Step 1411, in response to the operation on the entry control, open the friend sharing selection webpage.

[0315] Step 1420: When the friend sharing selection webpage is in an open state, the first sub-webpage obtains webpage data of the friend sharing selection webpage.

[0316] In some embodiments, the first sub-webpage obtains data information from a data file, which is a file shared by the first sub-webpage and the homologous webpage of the first sub-webpage. The data information is stored in the data file by the friend sharing selection webpage, and the data information is used to indicate the webpage data; the first sub-webpage obtains the webpage data based on the data information.

[0317] In some embodiments, the data information is identification information, which is sent to the friend sharing selection webpage by the server of the friend sharing selection webpage after storing the webpage data sent by the friend sharing selection webpage, and the identification information is used to identify the webpage data stored in the server; or, the data information is webpage data.

[0318] In some embodiments, when the amount of web page data is greater than or equal to a first threshold, the data information is identification information; when the amount of web page data is less than the first threshold, the data information is web page data.

[0319] In some embodiments, when the data information is identification information, the first sub-webpage obtains the webpage data from the server according to the identification information.

[0320] In some embodiments, the video playing webpage sends a query message to the first sub-webpage, where the query message is used to inquire whether the data information in the data file is changed.

[0321] In some embodiments, when the first sub-webpage queries the data file based on the query information and determines that the data information has changed, the first sub-webpage obtains the data information from the data file.

[0322] In some embodiments, when the friend sharing selection webpage is in an opened state and the video playing webpage is not visible, when the video playing webpage is redisplayed based on the friend sharing selection webpage, the video playing webpage sends a query message to the first sub-webpage.

[0323] In some embodiments, when the friend sharing selection webpage is in an open state and the video playback webpage remains displayed, the video playback webpage sends an inquiry message to the first sub-webpage in a polling form.

[0324] In some embodiments, the first sub-webpage receives prompt information sent by the friend sharing selection webpage, where the prompt information is used to indicate that data information in the data file has changed, or that the friend sharing selection webpage has generated a storage event for the data information.

[0325] In some embodiments, after receiving the prompt information, the first sub-webpage obtains the data information from the data file.

[0326] Step 1430: The first sub-webpage sends webpage data to the video playback webpage.

[0327] In some embodiments, when the friend sharing selection webpage is opened, the video playback webpage is not visible.

[0328] In some embodiments, when switching back to the video playback webpage from the friend sharing selection webpage, the video playback webpage is redisplayed, and the redisplayed video playback webpage includes the webpage data.

[0329] In some embodiments, when the friend sharing selection webpage is already opened, the video playback webpage remains displayed.

[0330] In some embodiments, after the video playback webpage acquires the webpage data, the webpage data is displayed in the video playback webpage.

[0331] In some embodiments, the component is an iframe, the first sub-webpage is a sub-webpage constructed by the iframe, and the first sub-webpage is not displayed.

[0332] In some embodiments, the first sub-webpage sends webpage data to the video playback webpage by using cross-document message transmission.

[0333] In some embodiments, the friend sharing selection webpage is a subordinate webpage of the video playing webpage.

[0334] The technical solution provided by the embodiment of the present application takes into account the limitations of the homology policy in the related art. In the video application, the present application introduces the first sub-webpage as an intermediate medium to achieve cross-webpage communication between a video playback webpage and a friend sharing selection webpage of non-homologous origin. Specifically, the first sub-webpage is a sub-webpage created by a component embedded in the video playback webpage, so the first sub-webpage and the video playback webpage can communicate with each other. Moreover, when the first sub-webpage is created by the component embedded in the video playback webpage, the created first sub-webpage and the friend sharing selection webpage are homologous webpages, so the first sub-webpage and the friend sharing selection webpage can communicate with each other. Based on this, cross-webpage communication between a video playback webpage and a friend sharing selection webpage of non-homologous origin with the first sub-webpage as an intermediate medium is achieved.

[0335] In one application scenario, the application is a novel reading application, the first webpage is a bookshelf webpage, and the second webpage is a book storage selection webpage. Fig.15 A flowchart of a cross-webpage communication method provided by another embodiment of the present application is shown. The execution subject of the method may be the terminal device 10 described above, such as the execution subject of each step is the client of the target application mentioned in the above embodiment. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as the "terminal device". The method may include at least one of the following steps (1510-1530).

[0336] Step 1510, when the bookshelf webpage is in an open state, run the first sub-webpage, the bookshelf webpage includes a portal control, the portal control is used to open a book storage selection webpage that has a different source from the bookshelf webpage, the first sub-webpage is created by a component embedded in the bookshelf webpage, and the first sub-webpage and the book storage selection webpage are of the same source.

[0337] Step 1511, in response to the operation on the entry control, open the book storage selection webpage.

[0338] Step 1520: When the book storage selection webpage is in an open state, the first sub-webpage obtains webpage data of the book storage selection webpage.

[0339] In some embodiments, the first sub-web page obtains data information from a data file. The data file is a file shared by the first sub-web page and the homologous web page of the first sub-web page. The data information is stored in the data file by the book library selection web page. The data information is used to indicate the web page data. The first sub-web page obtains the web page data based on the data information.

[0340] In some embodiments, the data information is identification information, which is sent to the book library selection webpage by the server of the book library selection webpage after storing the webpage data sent by the book library selection webpage, and the identification information is used to identify the webpage data stored in the server; or, the data information is webpage data.

[0341] In some embodiments, when the amount of web page data is greater than or equal to a first threshold, the data information is identification information; when the amount of web page data is less than the first threshold, the data information is web page data.

[0342] In some embodiments, when the data information is identification information, the first sub-webpage obtains the webpage data from the server according to the identification information.

[0343] In some embodiments, the bookshelf webpage sends a query message to the first sub-webpage, where the query message is used to inquire whether the data information in the data file has changed.

[0344] In some embodiments, when the first sub-webpage queries the data file based on the query information and determines that the data information has changed, the first sub-webpage obtains the data information from the data file.

[0345] In some embodiments, when the book storage selection webpage is in an open state and the bookshelf webpage is not visible, when the bookshelf webpage is redisplayed based on the book storage selection webpage, the bookshelf webpage sends a query message to the first sub-webpage.

[0346] In some embodiments, when the book storage selection webpage is in an open state and the bookshelf webpage remains displayed, the bookshelf webpage sends inquiry information to the first sub-webpage in the form of polling.

[0347] In some embodiments, the first sub-webpage receives prompt information sent by the book storage selection webpage, where the prompt information is used to indicate that the data information in the data file has changed, or that the book storage selection webpage has generated a storage event for the data information.

[0348] In some embodiments, after receiving the prompt information, the first sub-webpage obtains the data information from the data file.

[0349] Step 1530: The first sub-webpage sends webpage data to the bookshelf webpage.

[0350] In some embodiments, when the book storage selection webpage is open, the bookshelf webpage is not visible.

[0351] In some embodiments, when switching back from the book storage selection webpage to the bookshelf webpage, the bookshelf webpage is redisplayed, and the redisplayed bookshelf webpage includes the webpage data.

[0352] In some embodiments, when the book storage selection webpage is already opened, the bookshelf webpage remains displayed.

[0353] In some embodiments, after the bookshelf webpage acquires the webpage data, the webpage data is displayed in the bookshelf webpage.

[0354] In some embodiments, the component is an iframe, the first sub-webpage is a sub-webpage constructed by the iframe, and the first sub-webpage is not displayed.

[0355] In some embodiments, the first sub-webpage sends webpage data to the bookshelf webpage by cross-document message transmission.

[0356] In some embodiments, the book storage selection webpage is a subordinate webpage of the bookshelf webpage.

[0357] The technical solution provided by the embodiment of the present application takes into account the limitations of the homology policy in the related art. In the present application, the first sub-webpage is introduced as an intermediate medium in the video conferencing application to realize cross-webpage communication between the bookshelf webpage and the book storage selection webpage of non-homologous origin. Specifically, the first sub-webpage is a sub-webpage created by a component embedded in the bookshelf webpage, so the first sub-webpage and the bookshelf webpage can communicate with each other. Moreover, when the first sub-webpage is created by the component embedded in the bookshelf webpage, the created first sub-webpage and the book storage selection webpage are homologous webpages, so the first sub-webpage and the book storage selection webpage can communicate with each other. Based on this, cross-webpage communication between the bookshelf webpage and the book storage selection webpage of non-homologous origin with the first sub-webpage as the intermediate medium is realized.

[0358] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0359] Please refer to Fig.16 , which shows a block diagram of a cross-webpage communication device provided by an embodiment of the present application. The device has the function of implementing the above-mentioned cross-webpage communication method, and the function can be implemented by hardware, or by hardware executing corresponding software. The device can be the terminal device introduced above, or it can be set in the terminal device. Fig.16 As shown, the device 1600 may include: an operation module 1610 , an acquisition module 1620 , and a sending module 1630 .

[0360] The running module 1610 is used to run the first sub-webpage when the first webpage is in an open state. The first webpage includes an entry control, and the entry control is used to open a second webpage that has a different source from the first webpage. The first sub-webpage is created by a component embedded in the first webpage, and the first sub-webpage and the second webpage are webpages of the same source.

[0361] The running module 1610 is also used to open the second web page in response to an operation on the entry control.

[0362] The acquisition module 1620 is configured to acquire the webpage data from the first sub-webpage when the second webpage is in an opened state and the webpage data of the second webpage is changed.

[0363] The sending module 1630 is configured to, when the first web page is in a display state, send the web page data to the first web page by the first sub-web page.

[0364] In some embodiments, the acquisition module 1620 is used to obtain data information from a data file by the first sub-web page, and the data file is a file shared by the first sub-web page and the homologous web page of the first sub-web page, and the data information is stored in the data file by the second web page, and the data information is used to indicate the web page data; the first sub-web page obtains the web page data based on the data information.

[0365] In some embodiments, the data information is identification information, and the identification information is sent to the second web page by the server of the second web page after storing the web page data sent by the second web page, and the identification information is used to identify the web page data stored in the server; or, the data information is the web page data.

[0366] In some embodiments, when the data volume of the web page data is greater than or equal to a first threshold, the data information is the identification information; when the data volume of the web page data is less than the first threshold, the data information is the web page data.

[0367] In some embodiments, the acquisition module 1620 is used to, when the data information is the identification information, obtain the webpage data from the server according to the identification information by the first sub-webpage.

[0368] In some embodiments, the sending module 1630 is further used to send an inquiry message from the first web page to the first sub-web page, where the inquiry message is used to inquire whether the data information in the data file is changed.

[0369] In some embodiments, the acquisition module 1620 is used to obtain the data information from the data file by the first sub-webpage when the first sub-webpage queries the data file based on the query information and determines that the data information has changed.

[0370] In some embodiments, the sending module 1630 is also used for, when the second web page is in an opened state and the first web page is not visible, when the first web page is redisplayed based on the second web page, to send an inquiry message from the first web page to the first sub-web page; when the second web page is in an opened state and the first web page remains displayed, the first web page sends the inquiry message to the first sub-web page in the form of polling.

[0371] In some embodiments, the sending module 1630 is further configured to receive, from the first sub-webpage, a prompt message sent by the second webpage, where the prompt message is used to indicate that the data information in the data file has changed, or that the second webpage generates a storage event for the data information.

[0372] In some embodiments, the obtaining module 1620 is configured to obtain the data information from the data file after the first sub-webpage receives the prompt message.

[0373] In some embodiments, the apparatus further includes a display module (not shown in the figure).

[0374] In some embodiments, when the second webpage is in an open state, the first webpage is not visible.

[0375] The display module is configured to redisplay the first webpage when switching back from the second webpage to the first webpage, and the redisplayed first webpage includes the webpage data.

[0376] In some embodiments, when the second webpage is in an open state, the first webpage remains displayed.

[0377] In some embodiments, the display module is configured to display the webpage data in the first webpage after the first webpage obtains the webpage data.

[0378] In some embodiments, the component is an iframe, the first sub-webpage is a sub-webpage constructed through the iframe, and the first sub-webpage is not displayed.

[0379] In some embodiments, the sending module 1630 is configured to send the webpage data from the first sub-webpage to the first webpage in a cross-document messaging manner.

[0380] In some embodiments, the second webpage is a subordinate webpage of the first webpage.

[0381] Compared with the related art, in which the message is broadcast to all web pages that pay attention to the communication channel, the technical solution provided by the embodiment of the present application introduces the first sub-webpage as an intermediate medium, realizes cross-webpage communication between any two web pages of different sources, and has good versatility. Specifically, the first sub-webpage is created by a component embedded in the first webpage, so the first sub-webpage and the first webpage can communicate with each other. When the first sub-webpage is created by the component embedded in the first webpage, the created first sub-webpage and the second webpage are web pages of the same source, so the first sub-webpage and the second webpage can communicate with each other. Since the first sub-webpage and the first webpage can communicate with each other, the first sub-webpage and the second webpage can communicate with each other, that is, the mutual communication between the first webpage and the second webpage is indirectly realized. In the case where the webpage data of the second webpage changes, the second webpage sends the webpage data of the second webpage to the first sub-webpage. When displaying the first webpage, the first webpage receives the webpage data of the second webpage sent by the first sub-webpage. Based on this, cross-webpage communication between the first webpage and the second webpage of non-same source with the first sub-webpage as the intermediate medium is realized, which is suitable for any two webpages of different sources that need to communicate, and has good versatility.

[0382] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0383] Please refer to Fig.17 , which shows a block diagram of a terminal device 1700 provided in one embodiment of the present application. The terminal device 1700 may be Figure 1 The terminal device in the computer system shown is used to implement the control method of the virtual character provided in the above embodiment. Specifically:

[0384] Typically, the terminal device 1700 includes: a processor 1701 and a memory 1702 .

[0385] The processor 1701 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 1701 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1701 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 1701 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1701 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0386] The memory 1702 may include one or more computer-readable storage media, which may be non-transitory. The memory 1702 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1702 is used to store a computer program, which is configured to be executed by one or more processors to implement the above-mentioned virtual character control method.

[0387] In some embodiments, the terminal device 1700 may further optionally include: a peripheral device interface 1703 and at least one peripheral device. The processor 1701, the memory 1702 and the peripheral device interface 1703 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 1703 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 1704, a display screen 1705, an audio circuit 1707 and a power supply 1708.

[0388] Those skilled in the art will understand that Fig.17 The structure shown in the figure does not constitute a limitation on the terminal device 1700, and may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.

[0389] In an exemplary embodiment, a computer-readable storage medium is further provided, wherein a computer program is stored in the storage medium, and when the computer program is executed by a processor, the above-mentioned cross-webpage communication method is implemented.

[0390] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random Access Memory), SSD (Solid State Drives) or an optical disk, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).

[0391] In an exemplary embodiment, a computer program product is also provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned cross-webpage communication method.

[0392] It should be noted that the collection and processing of relevant data (including web page data, etc.) in this application should be strictly in accordance with the requirements of relevant national laws and regulations when applied in examples, and the informed consent or separate consent of the personal information subject should be obtained, and subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.

[0393] It should be understood that the "multiple" mentioned in this article 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. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application are not limited to this.

[0394] The above description is only an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A cross-webpage communication method, characterized in that: The method comprises: When a first webpage is in an open state, a first sub-webpage is run, the first webpage includes a portal control, the portal control is used to open a second webpage of a different source from the first webpage, the first sub-webpage is created by a component embedded in the first webpage, and the first sub-webpage and the second webpage are webpages of the same source; In response to an operation on the portal control, opening the second webpage; When the second webpage is in an opened state and webpage data of the second webpage changes, the first sub-webpage obtains the webpage data; When the first web page is in a display state, the first sub-web page sends the web page data to the first web page.

2. The method according to claim 1, characterized in that The step of obtaining the webpage data from the first sub-webpage includes: The first sub-webpage obtains data information from a data file, wherein the data file is a file shared by the first sub-webpage and a webpage of the same source as the first sub-webpage, and the data information is stored in the data file by the second webpage, and the data information is used to indicate the webpage data; The first sub-webpage obtains the webpage data based on the data information.

3. The method according to claim 2, characterized in that The data information is identification information, which is sent to the second webpage by the server of the second webpage after storing the webpage data sent by the second webpage, and is used to identify the webpage data stored in the server; or, The data information is the web page data.

4. The method according to claim 3, characterized in that In a case where the data volume of the webpage data is greater than or equal to a first threshold, the data information is the identification information; When the data volume of the webpage data is less than the first threshold, the data information is the webpage data.

5. The method according to claim 3 or 4, characterized in that: The obtaining of the webpage data by the first sub-webpage based on the data information includes: In the case where the data information is the identification information, the first sub-webpage obtains the webpage data from the server according to the identification information.

6. The method according to any one of claims 2 to 5, characterized in that: The method further comprises: The first webpage sends a query message to the first sub-webpage, wherein the query message is used to inquire whether the data information in the data file is changed; The first sub-webpage obtaining data information from the data file includes: When the first sub-webpage queries the data file based on the query information and determines that the data information has changed, the first sub-webpage obtains the data information from the data file.

7. The method according to claim 6, characterized in that The sending of inquiry information from the first webpage to the first sub-webpage includes: When the second webpage is in an opened state and the first webpage is not visible, when the first webpage is redisplayed based on the second webpage, the first webpage sends a query message to the first sub-webpage; When the second webpage is in an opened state and the first webpage is kept displayed, the first webpage sends the inquiry information to the first sub-webpage in a polling form.

8. The method according to any one of claims 2 to 5, characterized in that: The method further comprises: The first sub-webpage receives prompt information sent by the second webpage, wherein the prompt information is used to indicate that the data information in the data file has changed, or the second webpage has generated a storage event for the data information; The first sub-webpage obtaining data information from the data file includes: After receiving the prompt information, the first sub-webpage obtains the data information from the data file.

9. The method according to any one of claims 1 to 8, characterized in that: When the second webpage is in an opened state, the first webpage is not visible; The method further comprises: When switching back from the second web page to the first web page, the first web page is redisplayed, and the redisplayed first web page includes the web page data.

10. The method according to any one of claims 1 to 8, characterized in that: When the second webpage is in an opened state, the first webpage remains displayed; The method further comprises: After the first webpage acquires the webpage data, the webpage data is displayed on the first webpage.

11. The method according to any one of claims 1 to 10, characterized in that: The component is an iframe, the first sub-webpage is a sub-webpage constructed by the iframe, and the first sub-webpage is not displayed.

12. The method according to any one of claims 1 to 11, characterized in that: The step of sending the webpage data to the first webpage by the first sub-webpage includes: The first sub-webpage sends the webpage data to the first webpage by using a cross-document message transmission method.

13. The method according to any one of claims 1 to 12, characterized in that: The second web page is a subordinate web page of the first web page.

14. A cross-webpage communication device, characterized in that: The device comprises: a running module, configured to run a first sub-webpage when a first webpage is in an opened state, wherein the first webpage includes a portal control, the portal control is configured to open a second webpage of a different origin from the first webpage, the first sub-webpage is created by a component embedded in the first webpage, and the first sub-webpage and the second webpage are webpages of the same origin; The running module is further configured to open the second webpage in response to an operation on the portal control; an acquisition module, configured to acquire the webpage data from the first sub-webpage when the second webpage is in an opened state and the webpage data of the second webpage is changed; The sending module is used to send the webpage data to the first webpage from the first sub-webpage when the first webpage is in a display state.

15. A terminal device, characterized in that: The terminal device includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the cross-webpage communication method as described in any one of claims 1 to 13.

16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is loaded and executed by a processor to implement the cross-webpage communication method as described in any one of claims 1 to 13.

17. A computer program product, characterized in that The computer program product includes a computer program, which is stored in a computer-readable storage medium. The processor reads and executes the computer program from the computer-readable storage medium to implement the cross-webpage communication method as described in any one of claims 1 to 13.