Method, device and equipment for closing popup window by monitoring cookie and storage medium

By monitoring the preset keywords in the cookie, the problem of pop-up window not being closed in time is solved, user interaction is optimized, and user experience of network interaction is improved.

CN120295701APending Publication Date: 2025-07-11BEIJING BOE ENERGY TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510206907.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-24
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

In network interaction, pop-up windows are not closed in time, causing users to mistakenly think that the download has not started, reducing the user's user experience.

Method used

By monitoring the preset keywords in the cookie, periodically check whether they exist, and write the corresponding code into the cookie after the background task is completed to close the pop-up window.

Benefits of technology

It realizes timely closing pop-up windows, optimizes the interactive mode, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120295701A_ABST
    Figure CN120295701A_ABST
Patent Text Reader

Abstract

The invention discloses a method, device and equipment for closing a popup window by monitoring cooki e and a storage medium. The method for closing the pop-up window by monitoring the cooki e comprises the steps that when the pop-up window appears, preset keywords in the cooki e are periodically monitored in a preset duration period; after the processing task associated with the preset keyword is completed in the background, writing a code containing the preset keyword into the cooki e; and when it is monitored that the preset keyword appears in the cooki e, closing the pop-up window. According to the technical scheme, the pop-up window can be closed in time to optimize the interaction mode, so that the use experience of a user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of network interaction, and in particular to a method, device, equipment and storage medium for monitoring and closing a pop-up window through cookies. Background Art

[0002] When performing data interaction on the network, there are often scenarios where it is necessary to process background data to generate a downloadable file. Excessive data volume will cause the duration of background data processing, which may exceed the expected waiting duration of users. After triggering the download instruction, in order to avoid the long waiting duration from reducing the user experience, it is necessary to optimize the interaction method, including but not limited to prompting the user to wait through a page pop-up window. Since the processed downloadable file is downloaded through a new link, after the background file stream processing is completed and returned, the browser can start the download, but the pop-up window on the original page fails to close in time, causing the user to mistakenly think that the download has not started yet, thereby reducing the user interaction experience. How to properly solve the above problems has become an urgent issue in the industry. Summary of the Invention

[0003] The present invention provides a method, device, equipment and storage medium for monitoring and closing a pop-up window through cookies, so as to close the pop-up window in time, optimize the interaction mode, and thus improve the user experience.

[0004] According to a first aspect of the present invention, there is provided a method for monitoring and closing a pop-up window through cookies, the method for monitoring and closing a pop-up window through cookies comprising:

[0005] When the pop-up window appears, periodically monitor a preset keyword in the cookie at a preset time period;

[0006] After the processing task associated with the preset keyword is completed in the background, write a code containing the preset keyword into the cookie;

[0007] When it is monitored that the preset keyword appears in the cookie, close the pop-up window.

[0008] In one embodiment, before the pop-up window appears, it includes:

[0009] After receiving an operation instruction input by the user, analyze the duration required for the background to execute the operation instruction;

[0010] When the required duration is greater than a preset waiting duration, display corresponding prompt information in the form of a pop-up window to improve the user experience.

[0011] In one embodiment, before periodically monitoring for a preset keyword in a cookie at a preset time duration period, it includes:

[0012] Traverse the cookie file to determine whether the preset keyword already exists;

[0013] When the preset keyword exists, clear the preset keyword in the cookie.

[0014] In one embodiment, after the processing task associated with the preset keyword is completed in the background, it further includes:

[0015] Obtain the file content of the processing task and generate a network connection for downloading;

[0016] Download the file content of the processing task according to the network connection.

[0017] In one embodiment, the periodic monitoring for a preset keyword in a cookie includes:

[0018] Set the time step of the timer to the preset time duration period;

[0019] Monitor whether the preset keyword exists in the cookie every other time step.

[0020] In one embodiment, after monitoring that the preset keyword appears in the cookie, it further includes:

[0021] While closing the pop-up window, remove the timer.

[0022] According to a second aspect of the present invention, there is provided a device for closing a pop-up window by monitoring a cookie, including:

[0023] A monitoring module for periodically monitoring for a preset keyword in a cookie at a preset time duration period when the pop-up window appears;

[0024] A writing module for writing code containing the preset keyword into the cookie after the processing task associated with the preset keyword is completed in the background;

[0025] A closing module for closing the pop-up window when it is monitored that the preset keyword appears in the cookie.

[0026] According to a third aspect of the present invention, there is provided an electronic device, which includes: a communication interface, a processor, and a memory;

[0027] Wherein, the memory is used to store program instructions, and when the program instructions are executed by the processor communicatively connected to the memory through the communication interface, any of the above methods for closing pop - ups by monitoring cookies is implemented.

[0028] According to a fourth aspect of the present invention, there is provided a computer - readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a computer (for example, a processor in the computer), any of the above methods for closing pop - ups by monitoring cookies is implemented.

[0029] In summary, the present invention provides a method and a device for closing pop - ups by monitoring cookies. The method includes: when a pop - up appears, periodically monitoring a preset keyword in the cookie at a preset time - length period; after a processing task associated with the preset keyword is completed in the background, writing a code containing the preset keyword into the cookie; when the preset keyword appears in the cookie, closing the pop - up. The technical solution of the present application can close the pop - up in time to optimize the interaction mode, thereby improving the user experience.

[0030] Other features and advantages of the present invention will be described in the following specification, and, in part, will become apparent from the specification or will be understood by implementing the present invention. The objectives and other advantages of the present invention can be realized and obtained by the structures specifically pointed out in the written specification, claims, and drawings.

[0031] The technical solution of the present invention will be further described in detail below through the accompanying drawings and embodiments. Description of the Drawings

[0032] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0033] Figure 1 It is a flowchart of a method for closing pop - ups by monitoring cookies provided for an embodiment of the present invention;

[0034] Figure 2 It is a schematic diagram of a pop - up of a method for closing pop - ups by monitoring cookies provided for an embodiment of the present invention;

[0035] Figure 3Structural diagram of a device for monitoring cookie closing pop - ups provided by an embodiment of the present invention;

[0036] Figure 4 Structural diagram of an electronic device provided by an embodiment of the present invention. Detailed implementation manners

[0037] The features and exemplary embodiments of various aspects of the present application will be described in detail below. To make the objectives, technical solutions and advantages of the present application more clear and understandable, the present application will be further described in detail below in combination with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without some of these specific details. The following description of the embodiments is only intended to provide a better understanding of the present application by showing examples of the present application.

[0038] It should be noted that, in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non - exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, the elements defined by the statement "comprising..." do not exclude the existence of additional identical elements in the process, method, article or device including the said elements.

[0039] As Figure 1 shown, the present invention provides a method for monitoring cookie closing pop - ups. The method for monitoring cookie closing pop - ups includes:

[0040] In step S11, when the pop - up appears, the preset keywords in the cookie are monitored periodically at a preset time - length period;

[0041] In step S12, after the processing task associated with the preset keywords is completed in the background, a code containing the preset keywords is written into the cookie;

[0042] In step S13, when the preset keywords appear in the cookie, the pop - up is closed.

[0043] In one embodiment, the pop-up interaction process is optimized through cookie monitoring to enhance the user experience. The schematic diagram of the pop-up window is as shown in the appendix Figure 2 When the execution time of the background task exceeds the preset waiting time, a pop-up window is triggered to prompt the user and display the task progress or status information, such as "Generating downloadable file, please wait". A timer is used to monitor cookies at preset time intervals, and when a keyword is detected, the operation to close the pop-up window is triggered. There are also some optimization details and extended functions, including removing the timer, downloading the task file, cleaning up residual data, etc.

[0044] When the user executes a certain instruction, the system needs to judge the time required for the background task. If the task execution time is short, there is no need to prompt, and the operation can be completed seamlessly; but if the execution time is long, the user needs to be prompted to wait through a pop-up window, avoiding the problem that the user misunderstands that the system is unresponsive due to the long task time. After the background task is completed, the preset keyword is written into the cookie, and when the front end detects these keywords, the pop-up window is closed. The front end asynchronously obtains the background task status through a polling mechanism, avoiding blocking the main thread. The writing of the keyword is the signal that the background task is completed, ensuring the accuracy of the operation to close the pop-up window. By setting a timer, the cookie is checked at regular intervals to confirm whether the target keyword exists. The introduction of the timer can not only simplify the logic implementation, but also avoid resource waste caused by frequent detection while ensuring real-time performance. To avoid the interference of historical residual data on the monitoring results, before the periodic monitoring is started, the cookie file needs to be traversed and the existing preset keywords need to be cleared, so as to ensure that the detected keywords are generated by the current task, avoid mis-triggering the closing of the pop-up window, and the cleaning operation provides a clean initial state for the entire process, enhancing the logical rigor. After the background task is completed, not only the keyword needs to be written, but also the download can be directly performed through the generated download link. After the keyword is detected, the timer is removed while the pop-up window is closed, which can release system resources and prevent the timer from continuing to run and causing performance waste. After the pop-up window is closed, the method logic is completed and no additional operation is required.

[0045] The triggering of the pop-up window is based on the judgment of the execution duration of the background task; the periodic monitoring is started after the pop-up window is displayed, and the pop-up window is closed after the background task is completed and the keyword is written. The division of labor between the front end and the back end is fully utilized. After the background task is completed, the result is notified to the front end through the cookie. The front end asynchronously polls through the timer to capture the changes in the background status in real time.

[0046] The pop-up prompt solves the user's uncertainty about the task status, the periodic monitoring avoids system jams caused by frequent operations, and the resource management ensures system efficiency, further enhancing the user experience. For example, when a user uploads data to the background to generate a report, if the amount of data to be processed is large and the task execution time is long, a pop-up window prompts the user to wait. After the task is completed, the user downloads the file through the generated link.

[0047] In a preferred embodiment, it is used to process form submissions and pop-up displays on a web page. The following is the text content of the code:

[0048]

[0049]

[0050] The main functions of this code are to display a loading pop-up window, set the submission address of the form, and submit the form. Remove the Cookie named alarm_task_export and set a timer to check the value of the alarm_task_export Cookie once per second. If the Cookie value exists (i.e., the background processing is completed and the Cookie is written), close the pop-up window and clear the timer.

[0051] In a preferred embodiment, the text content of the code for processing file output and setting the Cookie of the HTTP response:

[0052]

[0053] The main functions of this code are to create a BytesIO instance for storing file data in memory. Save the file to the output object using wb.save(output). Move the pointer of the output object to the start position for reading data. Write the file content to the HTTP response through response.write(output.getvalue()). Set a Cookie named alarm_task_export with the value download using response.set_cookie, and specify the path of the Cookie as / cms / alarmMonitor. This is used to notify the front-end page that a certain task has been completed, such as a download task, so that the operation of closing the pop-up window can be triggered.

[0054] In application scenarios that require asynchronous processing (such as video processing or data calculation), the background status is fed back to the front end through cookies to achieve automatic closing of prompts after the task is completed. This is applicable to any system that requires pop-up interaction, avoiding user misunderstanding of system non-responsiveness due to long waiting times, thereby improving the interaction experience. With cookies as the core, through the linkage of pop-ups, periodic monitoring, and the completion status of background tasks, an efficient and user-friendly interaction loop is formed. Its logical structure is rigorous, and the operation steps are clear, which can not only meet the requirements of technical implementation but also fully consider the user experience. The designs of each link not only support each other logically but also have strong flexibility and adaptability in actual applications.

[0055] The technical solution in this embodiment can close the pop-up window in a timely manner to optimize the interaction mode, thereby improving the user experience.

[0056] In one embodiment, Figure 3 is a block diagram of a device for closing a pop-up window by monitoring cookies shown according to an exemplary embodiment. As Figure 3 shown, the device for closing a pop-up window by monitoring cookies includes a monitoring module 31, a writing module 32, and a closing module 33.

[0057] The monitoring module 31 is used to periodically monitor a preset keyword in the cookie at a preset time period when the pop-up window appears;

[0058] The writing module 32 is used to write code containing the preset keyword into the cookie after the processing task associated with the preset keyword is completed in the background;

[0059] The closing module 33 is used to close the pop-up window when the preset keyword appears in the cookie.

[0060] The monitoring module 31, the writing module 32, and the closing module 33 included in the block diagram of the device for closing a pop-up window by monitoring cookies are controlled to execute the method for closing a pop-up window by monitoring cookies described in any of the above embodiments.

[0061] As Figure 4 shown, the present invention provides an electronic device 400, which includes: a communication interface, a processor 401, and a memory 402;

[0062] Among them, the memory 402 is used to store program instructions. When the program instructions are executed by the processor 401 communicatively connected to the memory 402 through the communication interface, when a pop-up window appears, the preset keywords in the cookie are monitored periodically at a preset time period; after the processing task associated with the preset keywords is completed in the background, a code containing the preset keywords is written into the cookie; when the preset keywords appear in the cookie, the pop-up window is closed.

[0063] The present invention provides a computer-readable storage medium. Computer program instructions are stored on the computer-readable storage medium. When the computer program instructions are executed by a processor, when a pop-up window appears, the preset keywords in the cookie are monitored periodically at a preset time period; after the processing task associated with the preset keywords is completed in the background, a code containing the preset keywords is written into the cookie; when the preset keywords appear in the cookie, the pop-up window is closed.

[0064] It should be understood that the specific features, operations, and details described above regarding the method of the present invention can also be similarly applied to the apparatus and system of the present invention, or vice versa. Additionally, each step of the method of the present invention described above can be executed by the corresponding components or units of the apparatus or system of the present invention.

[0065] It should be understood that each module / unit of the apparatus of the present invention can be implemented in whole or in part by software, hardware, firmware, or a combination thereof. Each module / unit can be embedded in the processor of the computer device in the form of hardware or firmware or independent of the processor, or can be stored in the memory of the computer device in the form of software for the processor to call to execute the operations of each module / unit. Each module / unit can be implemented as an independent component or module, or two or more modules / units can be implemented as a single component or module.

[0066] In one embodiment, a computer device is provided, which includes a memory and a processor. Computer instructions executable by the processor are stored on the memory. When the computer instructions are executed by the processor, the processor is instructed to execute the steps of the method of the embodiments of the present invention. The computer device can be generally a server, a terminal, or any other electronic device with necessary computing and / or processing capabilities. In one embodiment, the computer device may include a processor, a memory, a network interface, a communication interface, etc., connected through a system bus. The processor of the computer device can be used to provide necessary computing, processing, and / or control capabilities. The memory of the computer device may include a non-volatile storage medium and an internal memory. An operating system, a computer program, etc. may be stored in or on the non-volatile storage medium. The internal memory can provide an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface and the communication interface of the computer device can be used to connect and communicate with external devices through a network. When the computer program is executed by the processor, the steps of the method of the present invention are executed.

[0067] The present invention can be implemented as a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method of the embodiments of the present invention are caused to be executed. In one embodiment, the computer program is distributed among a plurality of network-coupled computer devices or processors, so that the computer program is stored, accessed, and executed in a distributed manner by one or more computer devices or processors. A single method step / operation, or two or more method steps / operations, can be executed by a single computer device or processor or by two or more computer devices or processors. One or more method steps / operations can be executed by one or more computer devices or processors, and one or more other method steps / operations can be executed by one or more other computer devices or processors. One or more computer devices or processors can execute a single method step / operation, or execute two or more method steps / operations.

[0068] Those of ordinary skill in the art can understand that the method steps of the present invention can be implemented by a computer program to instruct relevant hardware such as a computer device or a processor. The computer program can be stored in a non-transitory computer-readable storage medium, and when the computer program is executed, the steps of the present invention are caused to be executed. Depending on the situation, any reference to a memory, storage, database, or other medium herein may include non-volatile and / or volatile memory. Examples of non-volatile memory include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), flash memory, magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid state disk, etc. Examples of volatile memory include random access memory (RAM), external cache memory, etc.

[0069] The technical features described above can be combined arbitrarily. Although not all possible combinations of these technical features are described, any combination of these technical features should be considered to be covered by this specification, as long as such a combination is not contradictory.

[0070] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for monitoring the closing of a cookie pop-up window, characterized in that, Including: When the pop-up window appears, periodically monitor the preset keywords in the cookie at a preset time period; After the processing task associated with the preset keyword is completed in the background, write the code containing the preset keyword into the cookie; When the preset keyword appears in the cookie, close the pop-up window.

2. The method for monitoring the closing of the cookie pop-up window according to claim 1, wherein Before the pop-up window appears, including: After receiving the operation instruction input by the user, analyze the time required to execute the operation instruction in the background; When the required time is greater than the preset waiting time, display the corresponding prompt message in the form of a pop-up window to improve the user experience.

3. The method for monitoring the closing of the cookie pop-up window according to claim 1, wherein, Before periodically monitoring the preset keywords in the cookie at a preset time period, including: Traverse the cookie file to determine whether the preset keyword already exists; When the preset keyword exists, clear the preset keyword in the cookie.

4. The method for monitoring the closing of the cookie pop-up window according to claim 1, wherein After the processing task associated with the preset keyword is completed in the background, further including: Obtain the file content of the processing task and generate a network connection for downloading; Download the file content of the processing task according to the network connection.

5. The method for monitoring the closing of the cookie pop-up window according to claim 1, characterized in that, Periodically monitoring the preset keywords in the cookie includes: Set the time step of the timer to the preset time period; Every interval of one time step, monitor whether the preset keyword exists in the cookie.

6. The method for monitoring the closing of the cookie pop-up window according to claim 5, wherein After the preset keyword appears in the cookie, further including: When closing the pop-up window, remove the timer.

7. A device for monitoring the closing of a cookie pop-up window, characterized in that, Including: Monitoring module, used to periodically monitor the preset keywords in the cookie at a preset time period when the pop-up window appears; Writing module, used to write the code containing the preset keyword into the cookie after the processing task associated with the preset keyword is completed in the background; Closing module, used to close the pop-up window when the preset keyword appears in the cookie.

8. The device for monitoring the cookie closing pop-up window according to claim 7, characterized in that: The monitoring module, the writing module and the closing module are controlled to execute the method for closing the pop-up window by monitoring the cookie according to any one of claims 1-6.

9. An electronic device, characterized in that, Including: Communication interface, processor, memory; Wherein, the memory is used to store program instructions, and when the program instructions are executed by the processor communicatively connected to the memory through the communication interface, the electronic device realizes the method for closing the pop-up window by monitoring the cookie according to any one of claims 1 to 6.

10. A computer-readable storage medium having program instructions stored thereon, characterized in that, When the program instructions are executed by a computer, the computer realizes the method for closing the pop-up window by monitoring the cookie according to any one of claims 1 to 6.