CN109284470B - Page window communication method and device - Google Patents

Page window communication method and device Download PDF

Info

Publication number
CN109284470B
CN109284470B CN201811249842.5A CN201811249842A CN109284470B CN 109284470 B CN109284470 B CN 109284470B CN 201811249842 A CN201811249842 A CN 201811249842A CN 109284470 B CN109284470 B CN 109284470B
Authority
CN
China
Prior art keywords
page
window
parameter
information
window object
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811249842.5A
Other languages
Chinese (zh)
Other versions
CN109284470A (en
Inventor
俞亮
熊瑾�
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Suixun Electronic Technology Co ltd
Original Assignee
Tianjin ByteDance Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin ByteDance Technology Co Ltd filed Critical Tianjin ByteDance Technology Co Ltd
Priority to CN201811249842.5A priority Critical patent/CN109284470B/en
Publication of CN109284470A publication Critical patent/CN109284470A/en
Application granted granted Critical
Publication of CN109284470B publication Critical patent/CN109284470B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Abstract

The disclosure provides a page window communication method and device, and belongs to the technical field of computer application. Wherein the method comprises the following steps: the first page calls a page opening function by using a second page parameter to be communicated so as to obtain a window object of the second page; the first page registers a page window in a window object of a second page and loads a callback function; when the first page detects that the load callback function is called, sending a communication registration request to a second page, wherein the communication registration request comprises a first check code and page parameters of the first page, so that when the second page determines that the first check code is legal, the window object of the first page is obtained according to the page parameters of the first page. Therefore, the page window communication method realizes the two-way communication between the page windows and improves the user experience.

Description

Page window communication method and device
Technical Field
The present disclosure relates to the field of computer application technologies, and in particular, to a page window communication method and apparatus.
Background
With the continuous development of internet technology and webpage programs, the application range of the internet is continuously expanded, and the requirements of people on the internet are higher and more complicated. For example, in a browser application, a webpage program is expected to meet the requirement of multi-screen operation, and the requirement is needed to achieve intercommunication among a plurality of page windows.
Postmessage methods provided by browsers can realize that one page window transmits messages to another page window. However, the above method can only realize one-way communication between one page window and another page window, and cannot realize two-way communication between page windows.
Disclosure of Invention
The page window communication method, the page window communication device, the electronic equipment and the storage medium are used for solving the problem that in the related art, the existing method for realizing the communication between the page windows by calling a window.
The page window communication method provided by the embodiment of the one aspect of the disclosure comprises the following steps: the first page calls a page opening function by using a second page parameter to be communicated so as to obtain a window object of the second page; the first page registers a page window in a window object of the second page and loads a callback function; and when detecting that the load callback function is called, the first page sends a communication registration request to the second page, wherein the communication registration request comprises a first check code and a page parameter of the first page, so that when the second page determines that the first check code is legal, the window object of the first page is obtained according to the page parameter of the first page.
The page window communication method provided by the embodiment of the other aspect of the disclosure comprises the following steps: the second page registers a message receiving callback function in the loading process; when the second page determines that the loading is finished, calling a window loading callback function, so that a first page registering the window loading callback function sends a communication registration request to the second page when detecting that the window loading callback function is called; when detecting that the message receiving callback function is called, the second page acquires a calling parameter of the message receiving callback function; the second page judges whether the first check code in the calling parameter is legal or not; and if the calling parameter is legal, the second page acquires the window object of the first page according to the first page parameter in the calling parameter.
An embodiment of another aspect of the present disclosure provides a page window communication apparatus, including: the acquisition module is used for calling a page opening function by the first page by using a second page parameter to be communicated so as to acquire a window object of the second page; the registration module is used for registering a page window loading callback function in the window object of the second page by the first page; and the sending module is used for sending a communication registration request to the second page when the first page detects that the load callback function is called, wherein the communication registration request comprises a first check code and a page parameter of the first page, so that when the second page determines that the first check code is legal, the window object of the first page is obtained according to the page parameter of the first page.
The page window communication device provided by another embodiment of the present disclosure includes: the registration module is used for registering the message receiving callback function in the loading process of the second page; the calling module is used for calling a window loading callback function when the second page determines that the loading is finished, so that a first page for registering the window loading callback function sends a communication registration request to the second page when detecting that the window loading callback function is called; the obtaining module is used for obtaining the calling parameter of the message receiving callback function when the second page detects that the message receiving callback function is called; the judging module is used for judging whether the first check code in the calling parameter is legal or not by the second page; and if the calling parameter is legal, the second page acquires the window object of the first page according to the first page parameter in the calling parameter.
An embodiment of another aspect of the present disclosure provides an electronic device, which includes: a processor and a memory; wherein the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to implement the page window communication method as described above.
A further aspect of the disclosure provides a computer-readable storage medium, on which a computer program is stored, wherein the program, when executed by a processor, implements the page window communication method as described above.
Another embodiment of the present disclosure provides a computer program, which when executed by a processor implements the page window communication method as described above.
According to the page window communication method, the page window communication device, the electronic equipment, the computer readable storage medium and the computer program, the page opening function is called through the first page by using the second page parameter to be communicated so as to obtain the window object of the second page, the page window is registered to load the callback function in the window object of the second page, and then the first page sends a communication registration request to the second page when detecting that the load callback function is called, wherein the communication registration request comprises the first check code and the page parameter of the first page, so that the second page obtains the window object of the first page according to the page parameter of the first page when determining that the first check code is legal. Therefore, the first page opens the second page and obtains the window object of the second page by calling the page opening function, and sends the communication registration request to the second page, so that the second page obtains the window object of the first page through the communication registration request, and then the first page and the second page can send information to the other side by using the window object of the other side, thereby realizing the two-way communication between the page windows and improving the user experience.
Additional aspects and advantages of the disclosure will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the disclosure.
Drawings
The foregoing and/or additional aspects and advantages of the present disclosure will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 is a schematic flowchart of a page window communication method according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of another page window communication method provided in the embodiment of the present disclosure;
fig. 3 is a schematic flowchart of another page window communication method provided in the embodiment of the present disclosure;
fig. 4 is a signaling interaction diagram of a page window communication method according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a page window communication device according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of another page window communication device according to an embodiment of the disclosure;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure;
fig. 8 is a schematic structural diagram of a non-transitory computer-readable storage medium according to an embodiment of the disclosure.
Detailed Description
Reference will now be made in detail to the embodiments of the present disclosure, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the like or similar elements throughout. The embodiments described below with reference to the drawings are exemplary and intended to be illustrative of the present disclosure, and should not be construed as limiting the present disclosure.
The disclosed embodiment provides a page window communication method aiming at the problem that in the related art, the existing method for realizing the communication between page windows by calling a window.
The page window communication method provided by the embodiment of the disclosure calls a page opening function by using a second page parameter to be communicated through a first page to obtain a window object of the second page, and registers a page window loading callback function in the window object of the second page, so that when the first page detects that the loading callback function is called, the first page sends a communication registration request to the second page, wherein the communication registration request includes a first check code and the page parameter of the first page, so that when the second page determines that the first check code is legal, the window object of the first page is obtained according to the page parameter of the first page. Therefore, the first page opens the second page and obtains the window object of the second page by calling the page opening function, and sends the communication registration request to the second page, so that the second page obtains the window object of the first page through the communication registration request, and then the first page and the second page can send information to the other side by using the window object of the other side, thereby realizing the two-way communication between the page windows and improving the user experience.
The page window communication method, apparatus, electronic device, storage medium, and computer program provided by the present disclosure are described in detail below with reference to the accompanying drawings.
The following describes the page window communication method provided by the embodiment of the present disclosure in detail, taking two page window sides for communication as examples.
First, a page window side initiating communication is taken as an example to describe the page window communication method provided by the embodiment of the present disclosure in detail.
Fig. 1 is a schematic flowchart of a page window communication method provided in an embodiment of the present disclosure, where the method is applied to a page window for initiating communication.
As shown in fig. 1, the page window communication method includes the following steps:
step 101, the first page calls a page opening function by using a second page parameter to be communicated so as to obtain a window object of the second page.
The second page parameter may include a Uniform Resource Locator (URL), a window name, a window feature, and a boolean value of a document displayed in the window. The page open function refers to a function for opening a new browser window or finding a named window.
It should be noted that, in the embodiment of the present disclosure, the page open function may be a window.open () function, and a syntax rule of the window.open () is window.open (URL, name, feature, place). The parameters URL, name, feature and place are respectively URL, window name, window feature and Boolean value of a document displayed in the page to be opened. The first page may call a page open function, and take a known parameter of the second page to be communicated as a parameter of the page open function, thereby opening the second page, and obtaining a return value of the page open function, that is, a window object of the second page.
Further, after the window object of the second page is obtained, the window object of the second page may be stored, so that the window object of the second page is called when the first page communicates with the second page. That is, in a possible implementation form of the embodiment of the present disclosure, after the step 101, the method may further include:
and caching the window object of the second page into a variable corresponding to the second page.
It should be noted that, for storing the window object of the second page, so as to be called when the first page sends information to the second page, a variable corresponding to the second page may be created and named, and then the obtained window object of the second page is cached in the variable corresponding to the second page. For example, the variable name of the variable corresponding to the second page may be set to child window.
And 102, the first page registers a page window in the window object of the second page and loads a callback function.
And the page window loads a callback function for indicating whether the second page is loaded completely.
It should be noted that, if the first page sends information to the second page before all elements in the second page are not loaded, an error may occur when the unloaded elements need to be referred to. Therefore, before the first page establishes communication with the second page, the first page needs to confirm that all elements in the second page are loaded completely, so as to avoid failure in establishing communication connection.
In this embodiment of the present disclosure, the page window load callback function may be a window.onload function, which may be executed after all elements in the page are loaded, so that the first page may register the window.onload function, i.e., the page window load callback function, in the window object of the second page, and when the first page detects that the page window load callback function is called, it may be determined that the second page is loaded completely.
Step 103, when detecting that the load callback function is called, the first page sends a communication registration request to the second page, where the communication registration request includes a first check code and a page parameter of the first page, so that when determining that the first check code is legal, the second page obtains the window object of the first page according to the page parameter of the first page.
In this embodiment of the present disclosure, when the first page detects that the load callback function registered in the window object of the second page is called, it may be determined that all elements in the second page have been loaded, that is, the first page may start to establish a communication connection with the second page.
It should be noted that, when establishing a communication connection with the second page, the first page may first send a communication registration request to the second page, where the communication registration request includes the first check code and the page parameter of the first page. The first check code is used for proving the validity of the first page so as to avoid establishing connection between an illegal page and the second page and ensure the network security. The first check code can be a self-preset password character string and is cached in the first page and the second page, when the second page receives the first check code sent by the first page, whether the first check code is consistent with the password character string cached by the second page can be judged, if so, the first check code can be determined to be legal, and communication connection can be established with the first page; if the first check code is inconsistent with the second check code, the first check code can be determined to be illegal, and the communication registration request sent by the first page can be rejected.
Correspondingly, the second page may obtain the window object of the first page according to the page parameter of the first page included in the communication registration request. When the second page determines that the first check code is legal, the second page can establish communication connection with the first page, namely, the window object of the first page can be obtained according to the page parameters of the first page, a variable corresponding to the first page is set, and the window object of the first page is cached in the variable corresponding to the first page, so that the second page can send information to the first page according to the window object of the first page. For example, the variable name of the set variable corresponding to the first page may be fasternow.
Furthermore, after the first page sends a communication registration request to the second page and the verification is successful, the two-way communication between the first page and the second page can be realized. Before the first page and the second page send information to each other, whether a variable corresponding to the other side is contained in the cache needs to be determined firstly, so that a window object of the other side is called, and the information is delivered successfully. That is, in a possible implementation form of the embodiment of the present disclosure, after the step 103, the method may further include:
when the first page calls a delivery information function, judging whether a cache contains a variable corresponding to the second page, wherein a parameter calling the delivery information function is information to be sent;
and if so, sending the information to be sent to the second page according to the window object of the second page cached in the variable corresponding to the second page.
It should be noted that, when the first page sends information to the second page, the information needs to be sent to the second page by calling a variable corresponding to the delivery information function and the second page. However, after the communication connection between the first page and the second page is established, if the first page or the second page is refreshed, the refreshed page loses a variable corresponding to another page, so that the refreshed page cannot successfully send information to another page. Therefore, before the first page sends information to the second page, whether the cache contains a variable corresponding to the second page or not can be judged firstly, if so, the information to be sent can be sent to the second page according to the window object of the second page cached in the variable corresponding to the second page by calling the delivery information function and setting the information to be sent as a parameter of the delivery information function. Accordingly, the second page may also transmit information to the first page in the same way.
For example, the delivery information function may be a postMessage function, and if the cached variable name corresponding to the first page is fasternow and the cached variable name corresponding to the second page is childWindow, the first page may send information to the second page by calling childWindow. Accordingly, information can be sent to the first page at the second page by calling fastmessage.
Further, if it is determined that the cache does not contain a variable corresponding to another page when the first page or the second page sends information to the counterpart, that is, the cache is refreshed after establishing a communication connection with another page, the information to be sent may be cached, so that the information to be sent is sent to another page again after reestablishing a connection with another page. That is, in a possible implementation form of the embodiment of the present disclosure, after the step 103, the method may further include:
and if the cache does not contain the variable corresponding to the second page, storing the information to be sent into a lost information array by taking the identifier of the second page as an index.
It should be noted that, if it is determined that the cache does not contain the variable corresponding to the second page when the first page sends information to the second page, it may be determined that the first page is refreshed after the second page establishes the communication connection, so that reference to the second page is lost, and information cannot be sent to the second page. Therefore, in a possible implementation form of the embodiment of the present disclosure, when the cache does not include the variable corresponding to the second page, the first page may store the information to be sent in the information array by using the identifier of the second page as an index, so that after the connection between the first page and the second page is reestablished, the information to be sent is resent to the second page, and the reliability of information transmission between page windows is improved. The missing information array may be preset in advance. Correspondingly, if the second page sends information to the first page, it is determined that the cache does not contain the variable corresponding to the first page, and the same method can be used to store the information to be sent into the missing information array.
The page window communication method provided by the embodiment of the disclosure calls a page opening function by using a second page parameter to be communicated through a first page to obtain a window object of the second page, and registers a page window loading callback function in the window object of the second page, so that when the first page detects that the loading callback function is called, the first page sends a communication registration request to the second page, wherein the communication registration request includes a first check code and the page parameter of the first page, so that when the second page determines that the first check code is legal, the window object of the first page is obtained according to the page parameter of the first page. Therefore, the first page opens the second page and obtains the window object of the second page by calling the page opening function, and sends the communication registration request to the second page, so that the second page obtains the window object of the first page through the communication registration request, and then the first page and the second page can send information to the other side by using the window object of the other side, thereby realizing the two-way communication between the page windows and improving the user experience.
In a possible implementation form of the present disclosure, if one of the pages performs a refresh operation after the first page and the second page establish a communication connection, the serial port object of the unrefreshed page may be obtained again through information sent by the unrefreshed page to the refreshed page, so as to reestablish a communication connection with the unrefreshed page.
The page window communication method provided by the embodiment of the present disclosure is further described below with reference to fig. 2.
Fig. 2 is a schematic flowchart of another page window communication method provided in the embodiment of the present disclosure.
As shown in fig. 2, the page window communication method includes the following steps:
step 201, when detecting that the message receiving callback function of the first page is called, the first page acquires a calling parameter of the message receiving callback function.
The message receiving callback function of the first page is registered when the first page is loaded and is used for receiving information sent to the first page by other pages. For example, the message receive callback function may be a window.
It should be noted that, when the first page receives information sent by another page, the parameter of the delivery information function called when the other page sends information to the first page may be obtained by calling the message receiving callback function, and the parameter calling the obtained delivery information function is used as the calling parameter of the message receiving callback function of the first page.
Step 202, determining whether the calling parameter includes a parameter of the second page, if yes, executing step 203; otherwise step 205 is performed.
Step 203, acquiring the window object of the second page according to the parameter of the second page.
It should be noted that the call parameter of the message receiving callback function of the first page is determined according to the parameter of the delivery information function called by the page sending information to the first page, and the parameter of the delivery information includes information to be sent, the type of the information to be sent, the current state of the call page, and the parameter information of the call page. If the calling parameter includes a parameter of the second page, it may be determined that the message currently sent to the first page is the second page, that is, the parameter of the second page may be obtained by calling the parameter, a window object of the second page may be obtained according to the parameter of the second page, and the window object may be cached in a variable corresponding to the second page, so as to reestablish the communication connection between the first page and the second page.
Furthermore, when the page windows are communicated, the information to be sent and the check code can be sent together, so that the page receiving the information can check the validity of the sent page, and the security of page communication is improved. That is, in a possible implementation form of the embodiment of the present disclosure, before the step 203, the method may further include:
and determining that the first check code in the calling parameter is legal.
It should be noted that the first page may determine the validity of the first check code by determining whether the first check code in the call parameter is consistent with the preset and cached password character string. Specifically, if the first check code in the calling parameter is consistent with the cached password character string, it may be determined that the first check code is legal, that is, the window object of the second page may be obtained, and a communication connection may be established with the second page; if the first check code in the calling parameter is inconsistent with the cached password character string, the first check code can be determined to be illegal, namely the window object of the second page can not be obtained, and the communication connection with the second page is refused to be established.
And step 204, sending the information to be sent in the lost information array by taking the identifier of the second page as an index to the second page according to the window object of the second page.
In this embodiment of the present disclosure, after the first page acquires the window object of the second page, that is, after the communication connection is reestablished with the second page, it may be determined whether the missing information data includes the information to be sent with the second page identifier as the index according to the window object of the second page. If the page window information is contained in the page window information, the information to be sent can be sent to the second page by calling a delivery information function, so that abnormal communication between the page windows caused by the fact that the communication connection between the first page and the second page is disconnected is avoided.
Further, after the information to be sent in the missing information array by the first page is sent to the second page by using the identifier of the second page as an index, the information to be sent by using the identifier of the second page as an index is invalid. Therefore, in a possible implementation form of the embodiment of the present disclosure, after the step 204, the method may further include:
and clearing the information to be sent in the lost information array by taking the identifier of the second page as an index.
It should be noted that, after the first page sends the to-be-sent information indexed by the identifier of the second page in the missing information array to the second page, the to-be-sent information indexed by the identifier of the second page becomes invalid information, and if the sent to-be-sent information is continuously stored in the missing information array, the sent to-be-sent information indexed by the identifier of the second page is repeatedly sent to the second page after the first page is re-connected with the second page next time. Therefore, the information to be sent can be cleared from the missing information array, so as to save the cache space and avoid the influence on the normal communication between the page windows caused by the repeated sending of the information to be sent.
Step 205, obtaining a window object of the third page according to the parameter of the third page in the calling parameters.
It should be noted that, in a possible implementation form of the embodiment of the present disclosure, mutual communication between multiple pages may be implemented, and therefore, when the first page determines that the call parameter of the message reception callback function does not include the parameter of the second page, then the third page that currently sends information to the first page may be another page that has previously established communication connection with the first page, or a new page that requests to establish communication connection with the first page, that is, the first page may also obtain the window object of the third page according to the parameter of the third page included in the call function, and cache the window object in the variable corresponding to the third page to establish communication connection between the first page and the third page.
Further, since the third page may be a page that has previously established a communication connection with the first page, or may be a new page that requests a communication connection with the first page, it may also be determined whether there is information to be transmitted that the first page has not been successfully transmitted to the third page. That is, in a possible implementation form of the embodiment of the present disclosure, after the step 205, the method may further include:
judging whether the lost information array contains information to be sent with the identifier of the third page as an index;
and if so, sending the information to be sent in the lost information array by taking the identifier of the third page as an index to the third page according to the window object of the third page.
It can be understood that, in the embodiment of the present disclosure, whether the missing information array includes the information to be sent with the identifier of the third page as the index may be determined according to the window object of the third page. If the third page is the page which is communicated with the first page before, the third page can be determined, that is, the information to be sent which takes the identifier of the third page as the index in the missing information array can be sent to the third page according to the window object of the third page, and the information to be sent which takes the identifier of the third page as the index in the missing information array is eliminated.
The page window communication method provided by the embodiment of the disclosure acquires a call parameter of a message receiving callback function when the first page detects that the message receiving callback function of the first page is called, acquires a window object of a second page according to the parameter of the second page when the call parameter is judged to contain the parameter of the second page, and then transmits information to be transmitted, which is indexed by an identifier of the second page in a missing information array, to the second page according to the window object of the second page; otherwise, acquiring the window object of the third page according to the parameter of the third page in the calling parameters. Therefore, the first page receives the calling parameter of the callback function through the message, acquires the window object of the page according to the page parameter contained in the calling parameter, reestablishes communication connection with the page disconnected before, and sends the information to be sent in the missing information array to the corresponding page, so that the two-way communication between the page windows is realized, the communication connection between the page windows is reestablished after one page window is refreshed, and the user experience is further improved.
The page window communication method provided by the embodiment of the present disclosure is described in detail below by taking the page window side that receives the communication request as an example.
The page window communication method provided by the embodiment of the present disclosure is further described below with reference to fig. 3.
Fig. 3 is a schematic flowchart of another page window communication method provided in the embodiment of the present disclosure, which is applied to a page window of a communication request.
As shown in fig. 3, the page window side of the communication request includes the following steps:
step 301, when the second page determines that the loading is completed, invoking a window loading callback function, so that the first page registering the window loading callback function sends a communication registration request to the second page when detecting that the window loading callback function is invoked.
The window loading callback function refers to a function which is registered in the second page and used for indicating whether the second page is loaded or not, wherein the function is used for opening the first page of the second page by calling a page opening function. For example, the window load callback function may be a window.
It should be noted that, if the first page sends information to the second page before all elements in the second page are not loaded, an error may occur when the unloaded elements need to be referred to. Therefore, when the second page is loaded, the window loading callback function is called immediately to notify the first page that the second page is loaded, and a communication registration request can be sent to the second page.
Step 302, when detecting that the message receiving callback function is called, the second page acquires a calling parameter of the message receiving callback function.
And the message receiving callback function of the second page is registered when the second page is loaded and is used for receiving the information sent to the second page by other pages. For example, the message receive callback function may be a window.
It should be noted that, when the second page receives information sent by another page, the message receiving callback function of the second page is called, a parameter of the delivery information function called when the other page sends information to the second page is acquired, and the acquired parameter of the delivery information function is used as a calling parameter of the message receiving callback function of the second page.
Step 303, the second page determines whether the first check code in the calling parameter is legal.
The first check code is used for proving the validity of the first page so as to avoid establishing connection between an illegal page and the second page and ensure network security. The first check code may be included in a communication registration request sent by the first page requesting to establish a communication connection with the second page, and the communication registration request further includes a page parameter of the first page.
It should be noted that the call parameter of the message receiving callback function of the second page is determined according to the parameter of the delivery information function called by the first page for sending information to the second page, and the parameter of the delivery information includes information to be sent, the type of the information to be sent, the current state of the call page, and the parameter information of the call page.
Further, a password character string for verifying whether the first check code is legal can be preset, and whether the first check code is legal is judged according to whether the first check code is consistent with the preset password character string. That is, in a possible implementation form of the embodiment of the present disclosure, the step 303 may include:
and the second page judges whether the first check code is matched with a preset second check code corresponding to the first page identifier.
It should be noted that, in a possible implementation form of the embodiment of the present disclosure, different pages may preset different second check codes, that is, a password character string for verifying whether the first check code is legal, and cache the second check code corresponding to each page with the identifier of the page as an index, so as to avoid establishing a connection between an illegal page and a second page, and further improve the security of communication between page windows.
Specifically, if the first check code is matched with the second check code corresponding to the first page identifier, it may be determined that the first check code is legal; if the first check code is not matched with the second check code corresponding to the first page identifier, it can be determined that the first check code is illegal, and the communication registration request of the first page is rejected.
And 304, if the second page is legal, the second page acquires the window object of the first page according to the first page parameter in the calling parameters.
In this disclosure, if the second page determines that the first check code is valid, a communication connection may be established with the first page, and according to a page parameter of the first page in the call parameter, a window object of the first page is obtained, and a variable corresponding to the first page is set, and the window object of the first page is cached in the variable corresponding to the first page, so that the second page may send information to the first page according to the window object of the first page. For example, the variable name of the set variable corresponding to the first page may be fasternow.
According to the page window communication method provided by the embodiment of the disclosure, when the second page determines that loading is completed, the window loading callback function is called, so that a first page of the registered window loading callback function sends a communication registration request to the second page when the window loading callback function is detected to be called, the second page acquires the calling parameter of the message receiving callback function when the message receiving callback function is detected to be called, and the second page acquires the window object of the first page according to the first page parameter in the calling parameter when the first check code in the calling parameter is determined to be legal. Therefore, the second page informs the first page through the window loading calling function, the loading is completed, so that the first page sends a communication registration request to the first page, the window object of the first page is obtained according to the calling parameter of the message receiving callback function, and then the first page and the second page can send information to the opposite side by using the window object of the opposite side, so that the two-way communication between page windows is realized, and the user experience is improved.
Fig. 4 is a signaling interaction diagram of a page window communication method according to an embodiment of the disclosure.
As shown in fig. 4, the page window communication method includes the following steps:
step 401, the first page calls a page opening function by using the second page parameter to be communicated, so as to obtain the window object of the second page.
Step 402, the second page registers the message receiving callback function in the loading process.
And step 403, when the second page determines that the loading is completed, calling a window loading callback function.
In step 404, the first page sends a communication registration request to the second page when detecting that the load callback function is called.
The communication registration request comprises a first check code and a page parameter of a first page, so that when the second page determines that the first check code is legal, a window object of the first page is obtained according to the page parameter of the first page.
Step 405, when detecting that the message receiving callback function is called, the second page acquires a calling parameter of the message receiving callback function.
Step 406, the second page judges whether the first check code in the calling parameter is legal or not;
step 407, if the second page is legal, the second page obtains the window object of the first page according to the first page parameter in the calling parameters.
The process includes that a page opening function is called through a first page by using a second page parameter to be communicated so as to obtain a window object of the second page, the second page registers a message receiving callback function in a loading process, the window is called to load the callback function when the fact that loading is completed is confirmed, the first page sends a communication registration request to the second page when the fact that the message receiving callback function is called is detected, the second page obtains a calling parameter of the message receiving callback function when the fact that the message receiving callback function is called is detected, whether a first check code in the calling parameter is legal or not is judged, and if the first check code is legal, the second page obtains the window object of the first page according to the first page parameter in the calling parameter. Therefore, the first page opens the second page and obtains the window object of the second page by calling the page opening function, and sends the communication registration request to the second page, so that the second page obtains the window object of the first page through the communication registration request, and then the first page and the second page can send information to the other side by using the window object of the other side, thereby realizing the two-way communication between the page windows and improving the user experience.
In order to implement the above embodiment, the present disclosure further provides a page window communication device.
Fig. 5 is a schematic structural diagram of a page window communication apparatus provided in an embodiment of the present disclosure, which is applied to a page window for initiating communication.
As shown in fig. 5, the page window communication device 50 includes:
a first obtaining module 501, configured to invoke a page opening function by using a second page parameter to be communicated in a first page, so as to obtain a window object of the second page;
a registration module 502, configured to register a page window loading callback function in a window object of the second page by the first page;
a first sending module 503, configured to send, by the first page, a communication registration request to the second page when the load callback function is detected to be called, where the communication registration request includes a first check code and a page parameter of the first page, so that when the second page determines that the first check code is legal, the window object of the first page is obtained according to the page parameter of the first page.
In practical use, the page window communication apparatus provided by the embodiment of the present disclosure may be configured in any electronic device to execute the page window communication method.
The page window communication device provided by the embodiment of the disclosure calls a page opening function by using a second page parameter to be communicated through a first page to obtain a window object of the second page, and registers a page window loading callback function in the window object of the second page, so that when the first page detects that the loading callback function is called, the first page sends a communication registration request to the second page, wherein the communication registration request includes a first check code and the page parameter of the first page, so that when the second page determines that the first check code is legal, the window object of the first page is obtained according to the page parameter of the first page. Therefore, the first page opens the second page and obtains the window object of the second page by calling the page opening function, and sends the communication registration request to the second page, so that the second page obtains the window object of the first page through the communication registration request, and then the first page and the second page can send information to the other side by using the window object of the other side, thereby realizing the two-way communication between the page windows and improving the user experience.
In a possible implementation form of the present disclosure, the page window communication device 50 further includes:
a caching module 504, configured to cache the window object of the second page in a variable corresponding to the second page.
In another possible implementation form of the present disclosure, the page window communication device 50 further includes:
a first determining module 505, configured to determine whether a variable corresponding to the second page is included in a cache when the first page calls a delivery information function, where a parameter of the delivery information function is information to be sent;
and if so, sending the information to be sent to the second page according to the window object of the second page cached in the variable corresponding to the second page.
In still another possible implementation form of the present disclosure, the page window communication device 50 further includes:
a storing module 506, configured to store the to-be-sent information into a missing information array with the identifier of the second page as an index when the cache does not include the variable corresponding to the second page.
In another possible implementation form of the present disclosure, the page window communication device 50 further includes:
a second obtaining module 507, configured to obtain, when the first page detects that the message reception callback function of the first page is called, a call parameter of the message reception callback function;
a second determining module 508, configured to determine whether the calling parameter includes a parameter of the second page;
if yes, acquiring a window object of the second page according to the parameter of the second page;
a second sending module 509, configured to send, according to the window object of the second page, to-be-sent information in the missing information array, where the identifier of the second page is used as an index, to the second page.
In another possible implementation form of the present disclosure, the page window communication device 50 further includes:
a third obtaining module 510, configured to, when the calling parameter does not include the parameter of the second page, obtain a window object of a third page according to the parameter of the third page in the calling parameter;
a third determining module 511, configured to determine whether the missing information array includes information to be sent with an identifier of a third page as an index;
and if so, sending the information to be sent in the lost information array by taking the identifier of the third page as an index to the third page according to the window object of the third page.
In still another possible implementation form of the present disclosure, the page window communication device 50 further includes:
the determining module 512 is configured to determine that the first check code in the invocation parameter is legal.
In another possible implementation form of the present disclosure, the page window communication device 50 further includes:
a clearing module 513, configured to clear the to-be-sent information in the missing information array, where the identifier of the second page is used as an index.
It should be noted that the foregoing explanation on the page window communication method embodiment shown in fig. 1, fig. 2, fig. 3, or fig. 4 is also applicable to the pushed information presentation apparatus 50 of this embodiment, and is not repeated here.
The page window communication device provided by the embodiment of the disclosure acquires a call parameter of a message reception callback function when detecting that the message reception callback function of a first page is called through the first page, acquires a window object of a second page according to the parameter of the second page when judging that the call parameter includes the parameter of the second page, and further transmits information to be transmitted, which is indexed by an identifier of the second page in a missing information array, to the second page according to the window object of the second page; otherwise, acquiring the window object of the third page according to the parameter of the third page in the calling parameters. Therefore, the first page receives the calling parameter of the callback function through the message, acquires the window object of the page according to the page parameter contained in the calling parameter, reestablishes communication connection with the page disconnected before, and sends the information to be sent in the missing information array to the corresponding page, so that the two-way communication between the page windows is realized, the communication connection between the page windows is reestablished after one page window is refreshed, and the user experience is further improved.
In order to implement the above embodiments, the present disclosure further provides another page window communication device.
Fig. 6 is a schematic structural diagram of another page window communication apparatus provided in the embodiment of the present disclosure, which is applied to a page window side receiving a communication request.
As shown in fig. 6, the page window communication device 60 includes:
the registration module 61 is configured to register the message receiving callback function in the loading process of the second page;
a calling module 62, configured to, when the second page determines that loading is completed, call a window load callback function, so that a first page that registers the window load callback function sends a communication registration request to the second page when detecting that the window load callback function is called;
an obtaining module 63, configured to obtain, when the second page detects that the message reception callback function is called, a call parameter of the message reception callback function;
a judging module 64, configured to judge, by the second page, whether the first check code in the calling parameter is legal;
and if the calling parameter is legal, the second page acquires the window object of the first page according to the first page parameter in the calling parameter.
In practical use, the page window communication apparatus provided by the embodiment of the present disclosure may be configured in any electronic device to execute the page window communication method.
The page window communication device provided by the embodiment of the disclosure calls the window loading callback function when the second page determines that the loading is completed, so that the first page of the registered window loading callback function sends a communication registration request to the second page when detecting that the window loading callback function is called, the second page obtains the calling parameter of the message receiving callback function when detecting that the message receiving callback function is called, and the second page obtains the window object of the first page according to the first page parameter in the calling parameter when determining that the first check code in the calling parameter is legal. Therefore, the second page informs the first page through the window loading calling function, the loading is completed, so that the first page sends a communication registration request to the first page, the window object of the first page is obtained according to the calling parameter of the message receiving callback function, and then the first page and the second page can send information to the opposite side by using the window object of the opposite side, so that the two-way communication between page windows is realized, and the user experience is improved.
In a possible implementation form of the present disclosure, the determining module 64 is specifically configured to:
and the second page judges whether the first check code is matched with a preset second check code corresponding to the first page identifier.
It should be noted that the foregoing explanation on the page window communication method embodiment shown in fig. 1, fig. 2, fig. 3, or fig. 4 is also applicable to the push information presenting device 60 of this embodiment, and is not repeated here.
The page window communication device provided by the embodiment of the disclosure calls the window loading callback function when the second page determines that the loading is completed, so that the first page of the registered window loading callback function sends a communication registration request to the second page when detecting that the window loading callback function is called, the second page obtains the calling parameter of the message receiving callback function when detecting that the message receiving callback function is called, and the second page obtains the window object of the first page according to the first page parameter in the calling parameter when determining that the first check code in the calling parameter is legal. Therefore, the second page informs the first page through the window loading calling function, the loading is completed, so that the first page sends a communication registration request to the first page, the window object of the first page is obtained according to the calling parameter of the message receiving callback function, and then the first page and the second page can send information to the opposite side by using the window object of the opposite side, so that the two-way communication between page windows is realized, and the user experience is improved.
In order to implement the above embodiments, the present disclosure further provides an electronic device.
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Referring now to FIG. 7, shown is a schematic diagram of an electronic device 700 suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 7, electronic device 700 may include a processing means (e.g., central processing unit, graphics processor, etc.) 701 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from storage 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the electronic apparatus 700 are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other by a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
Generally, the following devices may be connected to the I/O interface 705: input devices 706 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 707 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 708 including, for example, magnetic tape, hard disk, etc.; and a communication device 709. The communication means 709 may allow the electronic device 700 to communicate wirelessly or by wire with other devices to exchange data. While fig. 7 illustrates an electronic device 700 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via the communication means 709, or may be installed from the storage means 708, or may be installed from the ROM 702. The computer program, when executed by the processing device 701, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring at least two internet protocol addresses; sending a node evaluation request comprising the at least two internet protocol addresses to node evaluation equipment, wherein the node evaluation equipment selects the internet protocol addresses from the at least two internet protocol addresses and returns the internet protocol addresses; receiving an internet protocol address returned by the node evaluation equipment; wherein the obtained internet protocol address indicates an edge node in the content distribution network.
Alternatively, the computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: receiving a node evaluation request comprising at least two internet protocol addresses; selecting an internet protocol address from the at least two internet protocol addresses; returning the selected internet protocol address; wherein the received internet protocol address indicates an edge node in the content distribution network.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation of the unit itself, for example, the first retrieving unit may also be described as a "unit for retrieving at least two internet protocol addresses".
It should be noted that, for the implementation process and the technical principle of the electronic device of this embodiment, reference is made to the foregoing explanation of the page window communication method of the embodiment of the present disclosure, and details are not described here again.
The electronic device provided by the embodiment of the present disclosure may execute the page window communication method as described above, where a page open function is called by using a second page parameter to be communicated through a first page to obtain a window object of the second page, and a page window loading callback function is registered in the window object of the second page, and then when the first page detects that the loading callback function is called, a communication registration request is sent to the second page, where the communication registration request includes a first check code and a page parameter of the first page, so that when the second page determines that the first check code is legal, the window object of the first page is obtained according to the page parameter of the first page. Therefore, the first page opens the second page and obtains the window object of the second page by calling the page opening function, and sends the communication registration request to the second page, so that the second page obtains the window object of the first page through the communication registration request, and then the first page and the second page can send information to the other side by using the window object of the other side, thereby realizing the two-way communication between the page windows and improving the user experience.
In order to implement the above embodiments, the present disclosure also proposes a non-transitory computer-readable storage medium on which a computer program is stored, which when executed by a processor implements the page window communication method as described in the foregoing embodiments.
Fig. 8 is a schematic diagram illustrating a computer-readable storage medium according to an embodiment of the present disclosure. As shown in fig. 8, a computer-readable storage medium 800 having non-transitory computer-readable instructions 810 stored thereon according to an embodiment of the disclosure. The non-transitory computer readable instructions 810, when executed by a processor, perform all or a portion of the steps of the page window communication methods of the embodiments of the present disclosure previously described.
In order to implement the foregoing embodiments, an embodiment of a further aspect of the present disclosure provides a computer program, which when executed by a processor, implements the page window communication method according to the embodiment of the present disclosure.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present disclosure, "a plurality" means at least two, e.g., two, three, etc., unless explicitly specifically limited otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing steps of a custom logic function or process, and alternate implementations are included within the scope of the preferred embodiment of the present disclosure in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the embodiments of the present disclosure.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present disclosure may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present disclosure have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present disclosure, and that changes, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present disclosure.

Claims (18)

1. A method for page window communication, comprising:
the first page calls a page opening function by using a second page parameter to be communicated so as to obtain a window object of the second page;
the first page registers a page window in a window object of the second page and loads a callback function;
when the first page detects that the page window loading callback function is called, sending a communication registration request to the second page, wherein the communication registration request comprises a first check code and a page parameter of the first page, so that when the second page determines that the first check code is legal, a window object of the first page is obtained according to the page parameter of the first page, and the window object of the first page is cached to a variable corresponding to the first page, so that information is sent to the first page according to the window object of the first page;
caching the window object of the second page into a variable corresponding to the second page;
when the first page calls a delivery information function, judging whether a cache contains a variable corresponding to the second page, wherein a parameter calling the delivery information function is information to be sent;
and if so, sending the information to be sent to the second page according to the window object of the second page cached in the variable corresponding to the second page.
2. The method of claim 1, wherein after determining whether the cache includes the variable corresponding to the second page, further comprising:
and if not, storing the information to be sent into a lost information array by taking the identifier of the second page as an index.
3. The method of claim 2, wherein after storing the information to be transmitted in a missing information array with the identifier of the second page as an index, further comprising:
when the first page detects that the message receiving callback function of the first page is called, acquiring a calling parameter of the message receiving callback function;
judging whether the calling parameters contain the parameters of the second page or not;
if yes, acquiring a window object of the second page according to the parameter of the second page;
and sending the information to be sent in the lost information array by taking the identifier of the second page as an index to the second page according to the window object of the second page.
4. The method of claim 3, wherein after determining whether the call parameter includes the parameter of the second page, further comprising:
if not, acquiring a window object of a third page according to the parameter of the third page in the calling parameters;
judging whether the lost information array contains information to be sent with the identifier of the third page as an index;
and if so, sending the information to be sent in the lost information array by taking the identifier of the third page as an index to the third page according to the window object of the third page.
5. The method according to claim 3 or 4, wherein before the obtaining the window object of the second page according to the parameter of the second page, further comprising:
and determining that the first check code in the calling parameter is legal.
6. The method as claimed in claim 3 or 4, wherein after sending the information to be sent in the missing information array indexed by the identifier of the second page to the second page, further comprising:
and clearing the information to be sent in the lost information array by taking the identifier of the second page as an index.
7. A method for page window communication, comprising:
after a second page calls a page opening function by using a second page parameter on a first page, a callback function is received by a registration message in a loading process, wherein the first page acquires a window object of the second page according to a return value of the page opening function, and information is sent to the second page according to the window object of the second page;
when the second page determines that the loading is finished, calling a page window loading callback function, so that a first page registering the page window loading callback function sends a communication registration request to the second page when detecting that the page window loading callback function is called;
when detecting that the message receiving callback function is called, the second page acquires a calling parameter of the message receiving callback function;
the second page judges whether the first check code in the calling parameter is legal or not;
if the calling parameter is legal, the second page obtains a window object of the first page according to the first page parameter in the calling parameter;
caching the window object of the first page into a variable corresponding to the first page;
when the second page calls a delivery information function, judging whether a cache contains a variable corresponding to the first page, wherein a parameter calling the delivery information function is information to be sent;
and if so, sending the information to be sent to the first page according to the window object of the first page cached in the variable corresponding to the first page.
8. The method of claim 7, wherein the second page determining whether the first check code in the invocation parameter is valid comprises:
and the second page judges whether the first check code is matched with a preset second check code corresponding to the first page identifier.
9. A page window communication device, comprising:
the first acquisition module is used for calling a page opening function by the first page by using a second page parameter to be communicated so as to acquire a window object of the second page;
the registration module is used for registering a page window loading callback function in the window object of the second page by the first page;
a first sending module, configured to send, when the first page detects that the page window load callback function is called, a communication registration request to the second page, where the communication registration request includes a first check code and a page parameter of the first page, so that when the second page determines that the first check code is legal, the second page obtains a window object of the first page according to the page parameter of the first page, and caches the window object of the first page in a variable corresponding to the first page, so as to send information to the first page according to the window object of the first page;
the cache module is used for caching the window object of the second page into a variable corresponding to the second page;
the first judging module is used for judging whether a variable corresponding to the second page is contained in a cache or not when the first page calls a delivery information function, wherein a parameter calling the delivery information function is information to be sent;
and if the variable window object contains the information to be sent, sending the information to be sent to the second page according to the window object of the second page cached in the variable corresponding to the second page.
10. The apparatus of claim 9, further comprising:
and the storage module is used for storing the information to be sent into a lost information array by taking the identifier of the second page as an index if the information is not contained.
11. The apparatus of claim 10, further comprising:
the second obtaining module is used for obtaining the calling parameter of the message receiving callback function when the first page detects that the message receiving callback function of the first page is called;
the second judging module is used for judging whether the calling parameters contain the parameters of the second page or not;
a third obtaining module, configured to obtain, if the window object of the second page is included, the window object of the second page according to the parameter of the second page;
and the third sending module is used for sending the information to be sent in the lost information array by taking the identifier of the second page as an index to the second page according to the window object of the second page.
12. The apparatus of claim 11, further comprising:
a fourth obtaining module, configured to, if the window object is not included, obtain, according to a parameter of a third page in the call parameter, a window object of the third page;
the third judging module is used for judging whether the lost information array contains information to be sent with the identifier of the third page as an index;
and if the lost information array contains the window object of the third page, sending the information to be sent in the lost information array by taking the identifier of the third page as an index to the third page.
13. The apparatus of claim 11 or 12, further comprising:
and the determining module is used for determining that the first check code in the calling parameter is legal.
14. The apparatus of claim 11 or 12, further comprising:
and the clearing module is used for clearing the information to be sent in the lost information array by taking the identifier of the second page as an index.
15. A page window communication device, comprising:
the registration module is used for receiving a callback function by a registration message in a loading process after a second page calls a page opening function by using a second page parameter on a first page, wherein the first page acquires a window object of the second page according to a return value of the page opening function, and sends information to the second page according to the window object of the second page;
the calling module is used for calling a page window loading callback function when the second page determines that the loading is finished, so that a first page for registering the page window loading callback function sends a communication registration request to the second page when detecting that the page window loading callback function is called;
the obtaining module is used for obtaining the calling parameter of the message receiving callback function when the second page detects that the message receiving callback function is called;
the judging module is used for judging whether the first check code in the calling parameter is legal or not by the second page;
if the calling parameter is legal, the second page obtains a window object of the first page according to the first page parameter in the calling parameter;
the storage module is used for caching the window object of the first page into a variable corresponding to the first page;
the second judging module is used for judging whether the variable corresponding to the first page is contained in the cache or not when the second page calls the delivery information function, wherein the parameter calling the delivery information function is information to be sent;
and if the variable to be sent is contained in the first page, sending the information to be sent to the first page according to the window object of the first page cached in the variable corresponding to the first page.
16. The apparatus of claim 15, wherein the determining module is specifically configured to:
and the second page judges whether the first check code is matched with a preset second check code corresponding to the first page identifier.
17. An electronic device comprising a processor and a memory;
wherein the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, for implementing the page window communication method according to any one of claims 1 to 6 or 7 to 8.
18. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the program, when executed by a processor, implements the page window communication method according to any one of claims 1-6 or 7-8.
CN201811249842.5A 2018-10-25 2018-10-25 Page window communication method and device Active CN109284470B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811249842.5A CN109284470B (en) 2018-10-25 2018-10-25 Page window communication method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811249842.5A CN109284470B (en) 2018-10-25 2018-10-25 Page window communication method and device

Publications (2)

Publication Number Publication Date
CN109284470A CN109284470A (en) 2019-01-29
CN109284470B true CN109284470B (en) 2020-12-04

Family

ID=65177945

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811249842.5A Active CN109284470B (en) 2018-10-25 2018-10-25 Page window communication method and device

Country Status (1)

Country Link
CN (1) CN109284470B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109815429B (en) * 2019-01-31 2021-03-05 天津字节跳动科技有限公司 Browser page closing processing method and device
CN111625432B (en) * 2019-02-28 2023-03-28 北京字节跳动网络技术有限公司 Page loading time consumption determination method and device and computer readable storage medium
CN112968888A (en) * 2021-02-04 2021-06-15 慧影医疗科技(北京)有限公司 Double-screen interaction method and system for medical images
CN113282865A (en) * 2021-06-24 2021-08-20 广州欢网科技有限责任公司 Page access data acquisition method and device
CN114827231B (en) * 2022-04-11 2023-09-26 杭州指令集智能科技有限公司 Method and system for realizing multi-window point-to-point communication based on browser local storage

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20060121430A (en) * 2005-05-24 2006-11-29 주식회사 데이콤멀티미디어인터넷 Service system for direct download software contents and method thereof
CN103246667A (en) * 2012-02-08 2013-08-14 腾讯科技(深圳)有限公司 Method and device for cross-domain transfer of data
CN103309877A (en) * 2012-03-12 2013-09-18 腾讯科技(深圳)有限公司 Method and device for cross-domain communication and full-duplex communication
CN106469056A (en) * 2015-08-19 2017-03-01 三星电子株式会社 For providing the apparatus and method of information in the electronic device
CN106777184A (en) * 2016-12-22 2017-05-31 北京猎豹移动科技有限公司 A kind of page loading method, device and electronic equipment
CN107066618A (en) * 2017-05-09 2017-08-18 灯塔财经信息有限公司 Display methods and device after a kind of Webpage conversion
CN107315646A (en) * 2016-04-27 2017-11-03 北京京东尚科信息技术有限公司 Data flow control method and device between page assembly
CN107678863A (en) * 2016-08-01 2018-02-09 北京国双科技有限公司 The page assembly means of communication and device
CN108182131A (en) * 2017-12-13 2018-06-19 东软集团股份有限公司 Monitor method, apparatus, storage medium and the electronic equipment of application operation state

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106339264A (en) * 2016-08-29 2017-01-18 九次方财富资讯(北京)有限责任公司 Method and system for showing dual-publicity data web page realized based on Ajax asynchronous call technology
CN106897215A (en) * 2017-01-20 2017-06-27 华南理工大学 A kind of method gathered based on WebView webpages loading performance and user behavior flow data

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20060121430A (en) * 2005-05-24 2006-11-29 주식회사 데이콤멀티미디어인터넷 Service system for direct download software contents and method thereof
CN103246667A (en) * 2012-02-08 2013-08-14 腾讯科技(深圳)有限公司 Method and device for cross-domain transfer of data
CN103309877A (en) * 2012-03-12 2013-09-18 腾讯科技(深圳)有限公司 Method and device for cross-domain communication and full-duplex communication
CN106469056A (en) * 2015-08-19 2017-03-01 三星电子株式会社 For providing the apparatus and method of information in the electronic device
CN107315646A (en) * 2016-04-27 2017-11-03 北京京东尚科信息技术有限公司 Data flow control method and device between page assembly
CN107678863A (en) * 2016-08-01 2018-02-09 北京国双科技有限公司 The page assembly means of communication and device
CN106777184A (en) * 2016-12-22 2017-05-31 北京猎豹移动科技有限公司 A kind of page loading method, device and electronic equipment
CN107066618A (en) * 2017-05-09 2017-08-18 灯塔财经信息有限公司 Display methods and device after a kind of Webpage conversion
CN108182131A (en) * 2017-12-13 2018-06-19 东软集团股份有限公司 Monitor method, apparatus, storage medium and the electronic equipment of application operation state

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
不同浏览器页面窗口中的Java Applet间的通信;刘其成等;《微型机与应用》;20030131(第1期);第8-9页 *

Also Published As

Publication number Publication date
CN109284470A (en) 2019-01-29

Similar Documents

Publication Publication Date Title
CN109284470B (en) Page window communication method and device
CN104965848B (en) A kind of front end resource loading method and device
US8930457B2 (en) Proximity initiated co-browsing sessions
CN109743381B (en) Long connection interaction method and device for client and server
CN112312222A (en) Video sending method and device and electronic equipment
CN111432001A (en) Method, apparatus, electronic device, and computer-readable medium for jumping scenes
WO2015067189A1 (en) Method and apparatus for installing application
CN110781437A (en) Method and device for acquiring webpage image loading duration and electronic equipment
CN113761097A (en) Map tile loading method, device, equipment and medium for browser end
CN111596992B (en) Navigation bar display method and device and electronic equipment
CN107979577B (en) Terminal authentication method and device
CN111783010B (en) Webpage blank page monitoring method, device, terminal and storage medium
CN110619101A (en) Method and apparatus for processing information
CN110855655B (en) Information verification method, device, equipment and storage medium
CN112732457B (en) Image transmission method, image transmission device, electronic equipment and computer readable medium
CN111581556B (en) Page data processing method, device, electronic equipment and readable medium
CN114006988A (en) Doorbell response method, device, equipment and storage medium
CN109815429B (en) Browser page closing processing method and device
CN109669679B (en) Service detection and processing method and device and electronic equipment
CN110795670A (en) Webpage image monitoring method and device, electronic equipment and readable storage medium
CN113391860A (en) Service request processing method and device, electronic equipment and computer storage medium
CN112311843A (en) Data loading method and device
CN117294745B (en) Network connection state information sending method, device, electronic equipment and medium
CN104980471A (en) Network request packet report method, device and system
CN112261659B (en) Control method and device for terminal and server, terminal and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20210713

Address after: 200433 no.465 Guohe Road, Yangpu District, Shanghai

Patentee after: Shanghai suixun Electronic Technology Co.,Ltd.

Address before: 300000 Tianjin Binhai High-tech Zone Binhai Science Park, No. 39, No. 6 High-tech Road, 9-3-401

Patentee before: TIANJIN BYTEDANCE TECHNOLOGY Co.,Ltd.

TR01 Transfer of patent right