Page task processing method and device, equipment and storage medium

By embedding the script code of page tasks into the HTML file, the problem of slow page loading caused by additional network requests in traditional Web Worker technology is solved, resulting in faster page rendering and a better user experience.

CN121597927APending Publication Date: 2026-03-03BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411171707.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Traditional Web Worker technology requires additional network requests to retrieve script files, which slows down page loading and affects user experience.

Method used

By embedding the script code of the page task directly into the HTML file, replacing the original script reference tag, additional network requests are avoided, and the script code is extracted and executed directly from the HTML file.

Benefits of technology

It reduces network latency, improves page loading speed and execution efficiency, especially when network conditions are poor, reduces server load and improves network resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121597927A_ABST
    Figure CN121597927A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a page task processing method and device, equipment and a storage medium. Comprising the steps of obtaining a target HTML file; wherein the target HTML file comprises a script code of at least one page task, the target HTML file is obtained by replacing a script reference mark of at least one page task in an original HTML file with the script code, and the script reference mark is used for requesting the script code of the page task; extracting a script code of at least one page task from the target HTML file; and executing the script code of the at least one page task. According to the page task processing method provided by the embodiment of the invention, the script code of at least one page task can be directly extracted from the target HTML file to be executed, the script code of the page task does not need to be requested based on a script reference mark, and additional network requests can be reduced, so that the processing speed and efficiency of the page task are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for processing page tasks. Background Technology

[0002] In current applications (such as web applications), page load speed and performance are critical factors affecting user experience. Web Workers are a technology that allows scripts to run in a thread outside the main thread to perform complex and resource-intensive tasks, thus avoiding blocking page responsiveness. However, traditional Web Worker technologies typically require making additional network requests to retrieve the Worker scripts, which can slow down page load speeds, especially in scenarios where high load speed is critical, thus impacting user experience. Summary of the Invention

[0003] This disclosure provides a method, apparatus, device, and storage medium for processing page tasks, which reduces network latency by reducing additional network requests.

[0004] In a first aspect, embodiments of this disclosure provide a method for processing page tasks, including:

[0005] Obtain a target HTML file; wherein the target HTML file includes script code for at least one page task, and the target HTML file is obtained by replacing the script reference tags of at least one page task in the original HTML file with the script code, and the script reference tags are used to request the script code of the page task;

[0006] Extract script code for at least one page task from the target HTML file;

[0007] The script code that executes the at least one page task.

[0008] Secondly, embodiments of this disclosure also provide a page task processing apparatus, including:

[0009] A target HTML file acquisition module is used to acquire a target HTML file; wherein, the target HTML file includes script code for at least one page task, and the target HTML file is obtained by replacing the script reference tags of at least one page task in the original HTML file with the script code, and the script reference tags are used to request the script code of the page task;

[0010] The script code extraction module is used to extract script code for at least one page task from the target HTML file;

[0011] A script code execution module is used to execute the script code for the at least one page task.

[0012] Thirdly, embodiments of this disclosure also provide an electronic device, the electronic device comprising:

[0013] One or more processors;

[0014] Storage device for storing one or more programs.

[0015] When the one or more programs are executed by the one or more processors, the one or more processors implement the page task processing method as described in the embodiments of this disclosure.

[0016] Fourthly, embodiments of this disclosure also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform a page task processing method as described in embodiments of this disclosure.

[0017] This disclosure provides a method, apparatus, device, and storage medium for processing page tasks, including obtaining a target HTML file. The target HTML file includes script code for at least one page task. The target HTML file is obtained by replacing script reference tags for at least one page task in an original HTML file with the script code itself. The script reference tags are used to request the script code for the page task. The method involves extracting the script code for at least one page task from the target HTML file and executing the script code for the at least one page task. The page task processing method provided by this disclosure can directly extract and execute the script code for at least one page task from the target HTML file, eliminating the need to request the script code based on script reference tags. This reduces additional network requests and improves the processing speed and efficiency of page tasks. Attached Figure Description

[0018] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0019] Figure 1 This is a flowchart illustrating a page task processing method provided in an embodiment of this disclosure;

[0020] Figure 2 This is a schematic diagram of the structure of a page task processing device provided in an embodiment of this disclosure;

[0021] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0022] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0023] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0024] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0025] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0026] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0027] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0028] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0029] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.

[0030] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0031] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.

[0032] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.

[0033] In existing technologies, page task instances are typically created by referencing external script files in HTML files using script reference tags. This method requires initiating a new network request to retrieve the external script file. The page task can be a Web Worker task, the script reference tag can be represented as "new Worker(worker.js")", and the external script file can be a JavaScript file. Each independent Worker script requires a separate network request, which increases the number of requests and network latency, thus impacting page loading speed.

[0034] Figure 1 This is a flowchart illustrating a page task processing method provided in an embodiment of the present disclosure. The embodiments of the present disclosure are applicable to the situation of processing page tasks. The method can be executed by a page task processing device, which can be implemented in the form of software and / or hardware, or optionally, by an electronic device, such as a mobile terminal, a PC, or a server.

[0035] like Figure 1 As shown, the method includes:

[0036] S110, retrieve the target HTML file.

[0037] The target HTML (Hypertext Markup Language) file includes script code for at least one page task. The target HTML file is obtained by replacing the script reference tags for at least one page task in the original HTML file with the script code. The script reference tags are used to request the script code for the page task.

[0038] Here, a page task, also known as a web page task, refers to tasks other than page interaction tasks, such as resource calculation tasks, resource retrieval tasks, and resource upload tasks. In this embodiment, a page task can be a web worker task. The fact that the target HTML file includes script code for at least one page task can be understood as: the target HTML file contains, either inline or embedded, script code for at least one page task. The script code for a page task can be understood as program code written in a specified programming language within the execution script of the page task, which is used to execute the page task.

[0039] The script reference tag can be a task object created using a predefined task constructor, where the parameter of this task object is the uniform resource locator (URL) of the page task's script file. For example, assuming the page task is a web worker task and its script file is a JS file, a worker object is created using the worker constructor, with the URL of the JS file as its parameter. In the original HTML file, the script reference tag can be used to request the script code corresponding to the page task, and run that script code to execute the corresponding page task.

[0040] In this embodiment, the target HTML file is pre-compiled. Specifically, the pre-compilation method is as follows: extract at least one script reference mark for a page task from the original HTML file; replace the script reference mark in the original HTML file with the script code of the corresponding page task to obtain the target HTML file; wherein, the script code is the code in the script file of the page task.

[0041] In this embodiment, a compiler is first used to parse the original HTML file, find the script reference mark represented by the task object in the original HTML file, then use the compiler to read the code in the script file corresponding to the page task to obtain the script code, and finally delete the script reference mark and add the script code to the original position of the script reference mark, that is, replace the script reference mark with the script code, thereby obtaining the target HTML file.

[0042] Optionally, to obtain the target HTML file by replacing the script reference tags in the original HTML file with the script code of the corresponding page task, the method can be as follows: read the code from the script file of the page task to obtain the script code; add a preset code tag to the read script code; replace the script reference tags in the original HTML file with the corresponding script code added with the preset code tag to obtain the target HTML file.

[0043] Among them, the preset code tag can be a tag pre-set by the developer, which contains a preset string and is used to identify the script code of the page task. Exemplarily, the form of the preset code tag can be: "preset string:". The method of reading the code from the script file of the page task can be: using a compiler to read the code in the script file of the page task. The method of adding a preset code tag to the read script code can be: adding the preset code tag before the script code. Exemplarily, it can be expressed as: "preset string: script code". Finally, replace the script reference tags in the original HTML file with the corresponding script code added with the preset code tag to obtain the target HTML file. Exemplarily, assume that the script reference tag of the page task in the original HTML file is expressed as: <tag>script reference tag< / tag>; then the script code of the page task in the compiled target HTML file is expressed as: <tag>preset string: script code< / tag>. In this embodiment, adding a preset code tag to the read script code facilitates the identification and extraction of the script code of the page task, thereby improving the execution efficiency of the page task. In this embodiment, replacing the script reference tag of the page task in the original HTML file with the script code, that is, directly embedding the script code of the page task into the HTML file, can avoid additional network requests, thereby reducing network latency and improving the page loading speed. Especially in the case of poor network conditions or high latency, the effect is more obvious. At the same time, it reduces the request for the script file of the independent page task, reduces the load on the server, and improves the utilization rate of network resources.

[0044] Optionally, after replacing the script reference tags in the original HTML file with the corresponding script code of the page task, the following steps are further included: modifying the configuration information of the HTML file from including the script reference tags of the page task in the HTML file to including the script code of the page task in the HTML file.

[0045] The configuration information in the HTML file can include the configuration information for how page tasks are embedded in the HTML file. An HTML file containing a script reference tag for a page task indicates that the page task is embedded in the HTML file by embedding the script reference tag; an HTML file containing the script code for a page task indicates that the page task is embedded in the HTML file by embedding the script code for the page task.

[0046] In this embodiment, when executing a page task, the configuration information regarding the embedding method of the page task in the HTML file is first read. If the configuration information indicates that the HTML file contains the script code for the page task, the script code for the page task is directly extracted from the HTML file. If the configuration information indicates that the HTML file contains a script reference tag for the page task, a network request needs to be initiated based on the script reference tag to request the script code for the page task. In this embodiment, by replacing the script reference tag in the HTML file with the script code and modifying the corresponding configuration information, the version control and caching strategies become more unified and efficient.

[0047] S120, script code to extract at least one page task from the target HTML file.

[0048] In this embodiment, since preset code tags are added to the script code of the page task, the script code of the page task can first be searched for in the target HTML file based on the preset code tags, and then the found script code is extracted and processed. The method for searching for the script code of the page task in the target HTML file based on the preset code tags can be by matching the preset code tags with the content in the target HTML file.

[0049] Optionally, the method for extracting script code for at least one page task from the target HTML file can be: traversing the content of the target HTML file and matching the traversed content with preset code tags; if the traversed content matches the preset code tags, then extracting the script code corresponding to the traversed content.

[0050] In this embodiment, the content of the target HTML file is traversed sequentially from beginning to end. The traversed content is compared with preset code tags. If the traversed content matches the preset code tag, it indicates that the content corresponding to that preset code tag in the target HTML file is the script code for the page task to be determined. Finally, the script code for the determined page task is extracted. In this embodiment, there is no need to parse the HTML file piece by piece. At least one page task's script code is directly extracted from the target HTML file based on preset code tags. This not only saves computing resources but also improves the efficiency of script code extraction, thereby increasing the execution speed of the page task.

[0051] S130, script code that executes at least one page task.

[0052] The script code that executes at least one page task can be understood as the script code that runs each page task in order to achieve the function corresponding to each script code, that is, to execute the corresponding page task.

[0053] Optionally, the script code for executing at least one page task can be executed by: creating a page task instance based on the script code; or loading the page task instance into a created thread for execution.

[0054] In this embodiment, there is a one-to-one correspondence between threads and page task instances; that is, one page task is executed by one thread, which improves the execution efficiency of page tasks. The thread executing the page task instance can be created in advance or after the script code of the page task is extracted. This embodiment does not limit the timing of thread creation. Specifically, after obtaining the script code of the page task, a page task instance is created based on the script code, and the page task instance is loaded into the created thread for execution, thus implementing the function corresponding to the page task. In this embodiment, when executing a page task, the script code of the page task is directly extracted from the HTML file, and a page task instance is created for execution, ensuring the correct operation of the script code.

[0055] In this application scenario, while processing page tasks, the target HTML file can also be parsed to load the page; that is, loading the HTML file and executing page tasks can be done synchronously. When loading the HTML file, a page loading thread needs to be created. This thread can be the main thread, and the thread executing the page task instance can be a child thread. When creating the child thread, a communication connection needs to be established with the main thread for data communication between them. In this embodiment, the embedded script code can execute synchronously with the HTML file, allowing the page to render faster initially, enabling users to see page content more quickly, reducing waiting time, and improving user experience.

[0056] Optionally, after loading the page task instance into the created thread for execution, the method further includes: detecting the execution status of the page task instance executed in each thread; and storing the execution status in the message queue of each thread.

[0057] The execution status includes normal and abnormal states. In this embodiment, each thread executing a page task instance maintains a message queue to store the execution status of the page task instance. The execution status of the page task instances executed in each thread can be dynamically detected through a status monitoring mechanism. When the execution status is abnormal, the abnormal status is written to the corresponding message queue. When the thread executing the page task instance receives a status request from the main thread, it sends the execution status stored in the message queue to the main thread. Compared to the existing technology, which sends the status to the main thread as soon as an abnormal status is detected, this embodiment first stores the abnormal status in the message queue and then sends all the abnormal statuses in the message queue to the main thread based on the main thread's status request, which can greatly save the overhead of cross-thread communication.

[0058] This embodiment embeds the script code for page tasks directly into the HTML file, avoiding additional network requests, thereby reducing network latency and improving page loading speed. This is especially effective under poor network conditions or high latency. It also reduces requests to independent page task script files, lowering server load and improving network resource utilization. By replacing script reference tags in the HTML file with script code and modifying corresponding configuration information, version control and caching strategies become more consistent and efficient. When executing page tasks, the script code is extracted directly from the HTML file, and a page task instance is created for execution, ensuring correct script code execution. The embedded script code executes synchronously with the HTML file, allowing for faster initial page rendering, enabling users to see page content more quickly, reducing waiting time, and improving user experience.

[0059] The technical solution of this disclosure involves obtaining a target HTML file; wherein the target HTML file includes script code for at least one page task, and the target HTML file is obtained by replacing the script reference tags of at least one page task in the original HTML file with script code, the script reference tags being used to request the script code of the page task; extracting the script code of at least one page task from the target HTML file; and executing the script code of at least one page task. The page task processing method provided by this disclosure can directly extract and execute the script code of at least one page task from the target HTML file, without needing to request the script code of the page task based on script reference tags, which can reduce additional network requests and thus improve the processing speed and efficiency of page tasks.

[0060] Figure 2 This is a schematic diagram of the structure of a page task processing apparatus provided in an embodiment of the present disclosure, as shown below. Figure 2 As shown, the device includes:

[0061] The target HTML file acquisition module 210 is used to acquire a target HTML file; wherein, the target HTML file includes script code for at least one page task, and the target HTML file is obtained by replacing the script reference tags of at least one page task in the original HTML file with script code, and the script reference tags are used to request the script code of the page task;

[0062] The script code extraction module 220 is used to extract the script code for at least one page task from the target HTML file;

[0063] Script code execution module 230 is used to execute script code for at least one page task.

[0064] Optionally, if the target HTML file is pre-compiled, it also includes: a pre-compiled module for:

[0065] Extract script reference tags for at least one page task from the original HTML file;

[0066] Replace the script reference tags in the original HTML file with the corresponding script code from the page task to obtain the target HTML file; where the script code is the code in the script file of the page task.

[0067] Optionally, pre-compiled modules are also used for:

[0068] Read the code from the script file of the page task to obtain the script code;

[0069] Add preset code tags to the read script code;

[0070] Replace the script reference tags in the original HTML file with the corresponding script code that has been added with the preset code tags to obtain the target HTML file.

[0071] Optionally, the script code extraction module 220 is also used for:

[0072] Iterate through the content of the target HTML file and match the found content with preset code tags;

[0073] If the content encountered during iteration matches a preset code tag, the script code corresponding to that content will be extracted.

[0074] Optionally, it also includes: a configuration information modification module, used for:

[0075] Change the configuration information in the HTML file from script reference tags for page tasks within the HTML file to script code for page tasks within the HTML file.

[0076] Optionally, the script code execution module 230 is also used for:

[0077] Create page task instances based on script code;

[0078] The page task instance is loaded into the created thread for execution; there is a one-to-one correspondence between the thread and the page task instance.

[0079] Optionally, it also includes: an execution status detection module, used for:

[0080] Detect the execution status of page task instances executed in each thread;

[0081] The execution status is stored in the message queue of each thread.

[0082] The page task processing apparatus provided in this disclosure can execute the page task processing method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the method execution.

[0083] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this disclosure.

[0084] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Reference is made below. Figure 3 It illustrates an electronic device suitable for implementing embodiments of the present disclosure (e.g., Figure 3 The diagram below shows the structure of the terminal device or server 500. The terminal device in this embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and vehicle terminals (e.g., vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 3 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0085] like Figure 3As shown, electronic device 500 may include a processing unit (e.g., central processing unit, graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 502 or a program loaded from storage device 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of electronic device 500. The processing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. An edit / output (I / O) interface 505 is also connected to bus 504.

[0086] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 3 An electronic device 500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0087] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the methods of embodiments of this disclosure.

[0088] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0089] The electronic device provided in this embodiment and the page task processing method provided in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0090] This disclosure provides a computer storage medium storing a computer program that, when executed by a processor, implements the page task processing method provided in the above embodiments.

[0091] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0092] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0093] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0094] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to:

[0095] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: acquire a target HTML file; wherein the target HTML file includes script code for at least one page task, the target HTML file being obtained by replacing script reference tags for at least one page task in an original HTML file with the script code, the script reference tags being used to request the script code for the page task; extract the script code for at least one page task from the target HTML file; and execute the script code for the at least one page task.

[0096] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0097] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0098] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The name of a unit does not necessarily limit the unit itself; for example, the first acquisition unit can also be described as "a unit that acquires at least two Internet Protocol addresses".

[0099] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0100] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0101] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0102] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0103] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A method for processing page tasks, characterized in that, include: Obtain a target HTML file; wherein the target HTML file includes script code for at least one page task, and the target HTML file is obtained by replacing the script reference tags of at least one page task in the original HTML file with the script code, and the script reference tags are used to request the script code of the page task; Extract script code for at least one page task from the target HTML file; The script code that executes the at least one page task.

2. The method according to claim 1, characterized in that, The target HTML file is pre-compiled, and the pre-compilation method is as follows: Extract script reference tags for at least one page task from the original HTML file; The script reference tags in the original HTML file are replaced with the script code of the corresponding page task to obtain the target HTML file; wherein the script code is the code in the script file of the page task.

3. The method according to claim 2, characterized in that, The target HTML file is obtained by replacing the script reference tags in the original HTML file with the script code for the corresponding page task, including: Read the code from the script file of the page task to obtain the script code; Add preset code tags to the read script code; Replace the script reference tags in the original HTML file with the corresponding script code that has been appended with preset code tags to obtain the target HTML file.

4. The method according to claim 3, characterized in that, Extracting script code for at least one page task from the target HTML file, including: Traverse the content of the target HTML file and match the traversed content with the preset code tags; If the content traversed matches the preset code tag, the script code corresponding to the traversed content will be extracted.

5. The method according to claim 2, characterized in that, After replacing the script reference tags in the original HTML file with the script code for the corresponding page task, the method further includes: The configuration information in the HTML file is changed from the script reference tags containing page tasks in the HTML file to the script code containing page tasks in the HTML file.

6. The method according to claim 1, characterized in that, The script code that executes the at least one page task includes: Create a page task instance based on the script code; The page task instance is loaded into a created thread for execution; wherein, the thread corresponds one-to-one with the page task instance.

7. The method according to claim 6, characterized in that, After loading the page task instance into the created thread for execution, the process also includes: Detect the execution status of page task instances executed in each thread; The execution status is stored in the message queue of each thread.

8. A page task processing apparatus, characterized in that, include: A target HTML file acquisition module is used to acquire a target HTML file; wherein, the target HTML file includes script code for at least one page task, and the target HTML file is obtained by replacing the script reference tags of at least one page task in the original HTML file with the script code, and the script reference tags are used to request the script code of the page task; The script code extraction module is used to extract script code for at least one page task from the target HTML file; A script code execution module is used to execute the script code for the at least one page task.

9. An electronic device, characterized in that, The electronic device includes: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the page task processing method as described in any one of claims 1-7.

10. A storage medium comprising computer-executable instructions, which, when executed by a computer processor, are used to perform a processing method for a page task as described in any one of claims 1-7.