Single-page application searching method, device and equipment and computer storage medium

By parsing and replacing the HTML files and data resources of single-page applications (SPAs), static HTML resources are generated, solving the problem that search engine crawlers cannot crawl the content of SPAs. This enables comprehensive crawling of SPAs and secure and efficient resource acquisition.

CN115687735BActive Publication Date: 2026-07-03CHINA CONSTRUCTION BANK +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA CONSTRUCTION BANK
Filing Date
2022-10-26
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Search engine crawlers have poor support for crawling content from single-page applications, resulting in an inability to effectively retrieve relevant content from single-page applications, especially in multi-tenant shared resource mode where performance is insufficient.

Method used

By receiving HTML files and data resources sent by the target user agent server, parsing them to generate a DOM tree, loading JavaScript files, replacing anchor links with non-anchor links, generating static HTML resources, and sending them to the gateway, the web crawler can achieve comprehensive crawling.

Benefits of technology

It enables web crawlers to comprehensively crawl the content of single-page applications, allowing search engines to effectively retrieve relevant content from single-page applications, improving resource acquisition speed and security, reducing request response time, and enhancing user search efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115687735B_ABST
    Figure CN115687735B_ABST
Patent Text Reader

Abstract

The application discloses a single-page application search method, device and equipment and a computer storage medium. The single-page application search method comprises the following steps: receiving a hypertext markup language (HTML) file and data resources of a single-page application of a target user; parsing the HTML file to obtain a document object model (DOM) tree, and loading a JavaScript file relied on by the HTML file; executing the JavaScript file, replacing corresponding nodes in the DOM tree with the HTML file and the data resources of the target user, and generating a first static HTML resource; calling an anchor point parser, replacing anchor point links in the first static HTML resource with non-anchor point links, and obtaining a second static HTML resource; and sending the second static HTML resource to a gateway. In this way, the network crawler can comprehensively capture the content of the single-page application, and the search engine can effectively search the related content of the single-page application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of computer applications, and in particular relates to a single-page application search method, apparatus, device, storage medium, and computer program product. Background Technology

[0002] Single-page applications typically interact with users by dynamically rewriting portions of the current page, rather than by reloading the entire page from the server.

[0003] Therefore, search engine crawlers do not provide sufficient support for crawling the content of such applications, resulting in search engines being unable to retrieve relevant content from single-page applications. Summary of the Invention

[0004] This application provides a single-page application search method, apparatus, device, storage medium, and computer program product, which can optimize the server search device and enable existing search engine crawlers to effectively crawl the resources and content of multi-user single-page applications in the cloud.

[0005] In a first aspect, embodiments of this application provide a single-page application search method, the method comprising:

[0006] Receive the target user's single-page application's HTML file and data resources sent by the target user's agent server;

[0007] The HTML file is parsed by calling the HTML parser to obtain the Document Object Model (DOM) tree, and the JavaScript files that the HTML file depends on are loaded.

[0008] By calling the JavaScript engine to execute the JavaScript file, the corresponding nodes in the DOM tree are replaced with the target user's HTML file and data resources, generating the first static HTML resource;

[0009] By calling the anchor resolver, the anchor links in the first static HTML resource are replaced with non-anchor links to obtain the second static HTML resource;

[0010] Send the second static HTML resource to the gateway.

[0011] In some implementations, the method further includes, before receiving the HTML file and data resources of the target user's single-page application sent by the target user agent server:

[0012] Receive requests from the gateway to access user application resources;

[0013] By calling the user routing component to mark the request, a marked request is obtained to request the resource pointed to by the link from the target user agent server;

[0014] Check the target user's rendering result cache to see if it contains the target user's rendering result;

[0015] If the target user's rendering result is not included in the target user's rendering result cache, a tag request is sent to the target user's proxy server.

[0016] In some embodiments, where the target user rendering result cache includes the target user's rendering result, the method further includes:

[0017] Send the target user's rendering result from the target user's rendering result cache to the gateway.

[0018] In some implementations, the method further includes the following steps before parsing the HTML file by invoking an HTML parser:

[0019] The target user's proxy server request link is inspected by invoking a content filter;

[0020] If the target user agent server request link does not include the target link, the HTML file is parsed by calling the HTML parser.

[0021] In some implementations, the method further includes the following steps before parsing the HTML file by invoking an HTML parser:

[0022] The content filter filters the target resources pointed to by the request link from the target user's proxy server. The filtered content includes images, videos, and Cascading Style Sheets (CSS) files.

[0023] In some implementations, after sending the second static HTML resource to the gateway, the method further includes:

[0024] Write the first static HTML resource into the rendering result cache of the corresponding target user.

[0025] In some implementations, after writing the first static HTML resource into the rendering result cache of the corresponding target user, the method further includes:

[0026] The storage time of the target user's rendering result cache in the target user's rendering result cache area is detected. If the storage time is greater than a preset threshold, the target user's rendering result cache is deleted.

[0027] Secondly, embodiments of this application provide a single-page application search device, the device comprising:

[0028] The server-side renderer is used to receive the target user's single-page application's Hypertext Markup Language (HTML) files and data resources sent by the target user's proxy server;

[0029] An HTML parser is used to parse HTML files, obtain the Document Object Model (DOM) tree, and load the JavaScript files that the HTML files depend on.

[0030] The JavaScript engine is used to execute JavaScript files, replace the corresponding nodes in the DOM tree with the target user's HTML files and data resources, and generate the first static HTML resource.

[0031] An anchor resolver is used to replace anchor links in the first static HTML resource with non-anchor links to obtain the second static HTML resource.

[0032] A server-side renderer is used to send a second static HTML resource to the gateway.

[0033] In some implementations, the server-side renderer is also used to receive requests from the gateway to access user application resources, mark the requests by calling the user routing component, obtain a marked request for requesting a link to the resource from the target user agent server, query whether the target user's rendering result cache contains the target user's rendering result, and if the target user's rendering result cache does not contain the target user's rendering result, send a marked request to the target user agent server.

[0034] In some embodiments, the device further includes:

[0035] Content filters are used to inspect links requested by the target user proxy server. If the target link is not included in the request, the HTML file is parsed by calling the HTML parser.

[0036] In some implementations, the content filter described above is also used to filter the target resources pointed to by the request link from the target user agent server, including images, videos, and Cascading Style Sheets (CSS) files.

[0037] In some implementations, the server-side renderer is also used to write the first static HTML resource into the rendering result cache of the corresponding target user.

[0038] In some embodiments, the device further includes:

[0039] The timed cleaner is used to detect the storage time of the target user's rendering result cache in the target user's rendering result cache area. If the storage time is greater than a preset threshold, the target user's rendering result cache is deleted.

[0040] Thirdly, embodiments of this application provide a single-page application search device, the electronic device including: a processor and a memory storing computer program instructions;

[0041] When the processor executes computer program instructions, it implements the steps of the single-page application search method as described in any embodiment of the first aspect.

[0042] Fourthly, embodiments of this application provide a computer storage medium on which computer program instructions are stored. When executed by a processor, the computer program instructions implement the steps of the single-page application search method as described in any embodiment of the first aspect.

[0043] Fifthly, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform the steps of the single-page application search method as described in any embodiment of the first aspect.

[0044] The single-page application search method, apparatus, device, and computer storage medium of this application embodiment can receive the Hypertext Markup Language (HTML) file and data resources of the target user's single-page application sent by the target user's proxy server, parse the HTML file to obtain a Document Object Model (DOM) tree, load the JavaScript file that the HTML file depends on, call the JavaScript engine to execute the JavaScript file, replace the corresponding nodes in the DOM tree with the target user's HTML file and data resources, and replace anchor links with non-anchor links. Finally, the processed HTML resources are sent to the gateway. Thus, by replacing the corresponding nodes in the DOM tree with the target user's HTML file and data resources, and replacing anchor links that are unrecognizable by web crawlers with non-anchor links that web crawlers can recognize, a comprehensive crawling of the single-page application content can be achieved by the web crawler, thereby enabling the search engine to effectively retrieve relevant content of the single-page application. Attached Figure Description

[0045] Figure 1 This is a schematic diagram of a system according to an embodiment of this application;

[0046] Figure 2 This is a schematic diagram of a device provided in an embodiment of this application.

[0047] Figure 3 This is a flowchart illustrating a single-page application search method provided in an embodiment of this application;

[0048] Figure 4 This is a flowchart illustrating another single-page application search method provided in an embodiment of this application;

[0049] Figure 5This is a schematic diagram of the structure of a single-page application search device provided in an embodiment of this application;

[0050] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0051] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.

[0052] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0053] The acquisition, storage, use, and processing of data in this application all comply with the relevant provisions of national laws and regulations.

[0054] Single-page applications (SPAs) are a web application model that interacts with users by dynamically rewriting portions of the current page, rather than reloading the entire page from the server, thus avoiding interruptions to the user experience when switching between multiple pages.

[0055] Therefore, search engine crawlers do not provide sufficient support for crawling the content of such applications, resulting in search engines being unable to retrieve relevant content from single-page applications.

[0056] Furthermore, in a multi-tenant shared resource model, the performance of web crawlers in retrieving application content is insufficient, which can affect the normal indexing of single-page application content by search engines. Here, "tenant" refers to an enterprise or individual that invests in purchasing hardware cloud equipment and cloud management services to meet their information technology needs. In this embodiment, tenants are collectively referred to as users.

[0057] To address the problems of existing technologies, embodiments of this application provide a single-page application search method, apparatus, device, medium, and product. This method can be applied to cloud service search scenarios. The following will first combine... Figure 1 Describe the system for cloud service search scenarios.

[0058] In a multi-user shared resource model, user application resources are deployed in independent tenant environments, and access to these resources is controlled by the user's proxy server. The proxy server acts as an intermediary for the user's application resources. In this embodiment, the proxy server can be a web server.

[0059] Figure 1 This is a schematic diagram of a system according to an embodiment of this application. Figure 1 As shown, the system includes a gateway, devices, and multiple user agent servers. Figure 1 Only two user agent servers are shown schematically, namely User 1 Proxy Server and User 2 Proxy Server.

[0060] When a user requests access to a cloud service through the gateway, the gateway determines whether the request is from a web crawler by identifying the user agent identifier in the request. If it is a web crawler, the gateway forwards the request to the device. The device marks the request, generates a tagged request from the user to the target proxy server for a link to the resource, and checks whether the user's rendering result cache contains the user's rendering result. If the user's rendering result cache contains the user's rendering result, the device sends the user's rendering result to the gateway, which then sends it to the user.

[0061] If the user's rendering result is not included in the user's rendering result cache, a tag request is sent to the user agent server to retrieve the corresponding user rendering result resource from the user agent server. After processing the resource, it is sent to the gateway, which then sends it to the user.

[0062] Figure 1 The device includes multiple components, specifically a content filter, a server-side renderer, an HTTP proxy, tenant routing, an anchor interpreter, a JavaScript engine, and multiple tenant rendering caches, such as... Figure 2 As shown. The functions of each component in the device are combined. Figure 3 describe, Figure 3 This is a flowchart illustrating a single-page application search method provided in one embodiment of this application.

[0063] like Figure 3 As shown, the single-page application search method may specifically include the following steps:

[0064] S310: Receive the target user's single-page application's HTML file and data resources sent by the target user's agent server.

[0065] The server-side renderer receives the HTML file and data resources of the single-page application sent by the target user's proxy server to the gateway. The data resources are obtained by the server-side renderer by calling the HTTP proxy component.

[0066] The target user proxy server is a dedicated server set up for different users to store their respective application resources; it can be a World Wide Web (WEB) server. Hypertext Markup Language (HTML) is a language used by web browsers, and the target user's single-page application HTML file is used to communicate with the gateway.

[0067] S320. The HTML file is parsed by calling the HTML parser to obtain the Document Object Model (DOM) tree, and the JavaScript file that the HTML file depends on is loaded.

[0068] The HTML file is parsed by calling the device's HTML parser, resulting in the HTML Document Object Model (DOM) tree. The DOM tree is the HTML as a tree of nodes. In the DOM tree, each node represents an HTML tag or a text item within a tag.

[0069] When the Document Object Model (DOM) tree is obtained, the JavaScript file that the HTML file depends on is loaded. The JavaScript file has functions such as embedding dynamic text into the HTML page, responding to browser events, and reading and writing HTML elements, so that elements in the HTML file can be read and dynamic text can be embedded into the HTML page through the JavaScript file.

[0070] S330. By calling the JavaScript engine to execute the JavaScript file, the corresponding nodes in the DOM tree are replaced with the target user's HTML file and data resources, generating the first static HTML resource.

[0071] The JavaScript engine executes the JavaScript file, reads elements from the HTML file and dynamically embeds them into the text, dynamically generates the page, and replaces the corresponding nodes in the DOM tree with the target user's HTML file and data resources to obtain the first static HTML resource.

[0072] The corresponding node is a node in the DOM tree used by the JavaScript engine during the execution of the JavaScript file.

[0073] S340. By calling the anchor resolver, the anchor links in the first static HTML resource are replaced with non-anchor links to obtain the second static HTML resource.

[0074] Anchor parser is used to scan the first static HTML resource and replace anchor links in jump links with non-anchor links, such as replacing " / # / link" with " / anchor / link", and then obtaining the second static HTML resource.

[0075] S350, Send the second static HTML resource to the gateway.

[0076] Send the second static HTML resource to the gateway for further processing.

[0077] Therefore, by receiving the target user's HTML file and data resources for the single-page application sent by the target user's proxy server, the system parses the HTML file to obtain the Document Object Model (DOM) tree, loads the JavaScript file that the HTML file depends on, calls the JavaScript engine to execute the JavaScript file, replaces the corresponding nodes in the DOM tree with the target user's HTML file and data resources, and replaces anchor links with non-anchor links. Finally, the processed HTML resources are sent to the gateway. By replacing the corresponding nodes in the DOM tree with the target user's HTML file and data resources and replacing anchor links that web crawlers do not recognize with non-anchor links that web crawlers recognize, the system achieves comprehensive crawling of the single-page application content by web crawlers, thereby enabling search engines to effectively retrieve relevant content from the single-page application.

[0078] In some implementations, such as Figure 3 As shown, the method further includes S300 before receiving the HTML file and data resources of the target user's single-page application sent by the target user agent server.

[0079] S300 receives requests from the gateway to access user application resources, marks the requests by calling the user routing component, obtains a marked request for requesting the link to the resource from the target user agent server, queries the target user's rendering result cache to see if the target user's rendering result is included, and if the target user's rendering result is not included in the target user's rendering result cache, sends a marked request to the target user agent server.

[0080] The gateway receives requests for accessing application resources. The user routing component marks these requests, including identifying the target user and labeling the request as a marked request for that target user. This marked request is then used to request a link to the resource from the corresponding target user's proxy server. For each marked request, the system checks if the target user's rendering result cache contains the requested resource. If not, it sends a marked request to the target user's proxy server to request the resource.

[0081] In this way, by identifying and marking application resource access requests from the gateway, the corresponding target user agent server can be quickly located and a marking request can be sent to it, reducing request response time while improving resource acquisition speed.

[0082] In some implementations, the method further includes S360 before parsing the HTML file by invoking an HTML parser.

[0083] S360: The target user agent request link is checked by calling the content filter. If the target user agent server request link does not include the target link, the HTML file is parsed by calling the HTML parser.

[0084] The content filter checks the target proxy request link sent by the target user proxy server for resources. If the target user proxy server request link does not include the target link, the HTML parser is invoked to parse the HTML file sent by the target user proxy server.

[0085] The target link is a dangerous link or a link that is harmful to the target user.

[0086] In this way, by checking the proxy server request links of the target user, it is possible to effectively prevent the target user from being harmed, and improve the security and reliability of the target user's access to resources.

[0087] In some implementations, the method further includes S370 before parsing the HTML file by invoking an HTML parser.

[0088] S370. Filter the target resources pointed to by the target proxy request link through the content filter. The filtered content includes images, videos and Cascading Style Sheets (CSS) files.

[0089] The target resource requested by the target user's proxy server is filtered, and images, videos, and CSS files contained in the target resource are removed before the HTML file is parsed by the HTML parser.

[0090] In this way, filtering out images, videos, and CSS files in the target resource that web crawlers do not parse before the HTML parser parses the HTML file can improve parsing efficiency.

[0091] In some implementations, the method may further include S380 after the second static HTML resource is sent to the gateway.

[0092] S380. Write the first static HTML resource into the rendering result cache area of ​​the corresponding target user.

[0093] The sender will send the first static HTML resource generated after replacing the corresponding node in the DOM tree with the target user's HTML file and data resources to the corresponding target user's rendering result cache.

[0094] In this way, by storing the first static HTML resource in the corresponding target user rendering result cache, when the target user searches for the same rendering result again, the rendering result cache can be retrieved directly from the target user rendering result cache, reducing the target user search events and improving the target user search efficiency.

[0095] In some implementations, after writing the first static HTML resource into the rendering result cache of the corresponding target user, the method further includes S390.

[0096] S390. Detect the storage time of the target user rendering result cache in the target user rendering result cache area. If the storage time is greater than the preset threshold, delete the target user rendering result cache.

[0097] After writing the first static HTML resource into the rendering result cache area of ​​the corresponding target user, the storage time of the target user rendering result cache stored in the target user rendering result cache area is checked. If the storage time is greater than a preset threshold, the target user rendering result cache with a storage time greater than the preset threshold is deleted.

[0098] In this way, by periodically cleaning up the target user rendering result cache and deleting target user rendering result caches that have been stored for too long, sufficient storage space in the target user rendering result cache can be guaranteed.

[0099] Based on the same inventive concept, this application also provides a device for single-page application search. Specifically, in conjunction with... Figure 5 Please provide a detailed explanation.

[0100] Figure 5 This is a schematic diagram of the structure of a single-page application search device provided in one embodiment of this application.

[0101] like Figure 5As shown, the single-page application search device 500 may include:

[0102] The server-side renderer is used to receive the target user's single-page application's Hypertext Markup Language (HTML) files and data resources sent by the target user's proxy server;

[0103] An HTML parser is used to parse HTML files, obtain the Document Object Model (DOM) tree, and load the JavaScript files that the HTML files depend on.

[0104] The JavaScript engine is used to execute JavaScript files, replace the corresponding nodes in the DOM tree with the target user's HTML files and data resources, and generate the first static HTML resource.

[0105] An anchor resolver is used to replace anchor links in the first static HTML resource with non-anchor links to obtain the second static HTML resource.

[0106] A server-side renderer is used to send a second static HTML resource to the gateway.

[0107] In some implementations, the server-side renderer is also used to receive requests from the gateway to access user application resources, mark the requests by calling the user routing component, obtain a marked request for requesting a link to the resource from the target user agent server, query whether the target user's rendering result cache contains the target user's rendering result, and if the target user's rendering result cache does not contain the target user's rendering result, send a marked request to the target user agent server.

[0108] In some embodiments, the device further includes:

[0109] Content filters are used to inspect links requested by the target user proxy server. If the target link is not included in the request, the HTML file is parsed by calling the HTML parser.

[0110] In some implementations, the content filter described above is also used to filter the target resources pointed to by the request link from the target user agent server, including images, videos, and Cascading Style Sheets (CSS) files.

[0111] In some implementations, the server-side renderer is also used to write the first static HTML resource into the rendering result cache of the corresponding target user.

[0112] In some embodiments, the device further includes:

[0113] The timed cleaner is used to detect the storage time of the target user's rendering result cache in the target user's rendering result cache area. If the storage time is greater than a preset threshold, the target user's rendering result cache is deleted.

[0114] Therefore, by receiving the HTML file and data resources of the target user's single-page application sent by the target user's proxy server, the HTML file is parsed to obtain the Document Object Model (DOM) tree. The JavaScript files that the HTML file depends on are loaded, and the JavaScript engine is invoked to execute the JavaScript files. The corresponding nodes in the DOM tree are replaced with the target user's HTML file and data resources, and anchor links are replaced with non-anchor links. Finally, the processed HTML resources are sent to the gateway. This enables web crawlers to comprehensively crawl the content of single-page applications, thereby allowing search engines to effectively retrieve relevant content from single-page applications.

[0115] Figure 6 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application.

[0116] Electronic device 600 may include processor 601 and memory 602 storing computer program instructions.

[0117] Specifically, the processor 601 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0118] Memory 602 may include mass storage for data or instructions. For example, and not limitingly, memory 602 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 602 may include removable or non-removable (or fixed) media. Memory 602 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 602 is non-volatile solid-state memory.

[0119] Memory 602 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Therefore, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this disclosure. Processor 601 implements the computer program instructions stored in memory 602 to perform... Figure 1 The method / steps S110 to S160 in the illustrated embodiment are completed, and the desired outcome is achieved. Figures 1 to 6 The technical effects achieved by executing the methods / steps shown in the examples are not elaborated here for the sake of brevity.

[0120] In some examples, electronic device 600 may also include communication interface 603 and bus 610. For example, Figure 6 As shown, the processor 601, memory 602, and communication interface 603 are connected through bus 610 and complete communication with each other.

[0121] The communication interface 603 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.

[0122] Furthermore, in conjunction with the single-page application search method in the above embodiments, this application embodiment can provide a computer-readable storage medium for implementation. This computer-readable storage medium stores computer program instructions; when executed by a processor, these computer program instructions implement any of the single-page application search methods in the above embodiments.

[0123] This application also provides a computer program product in which the instructions, when executed by the processor of an electronic device, cause the electronic device to perform various processes that implement any of the above-described embodiments of the single-page application search method.

[0124] Examples of computer-readable storage media include non-transitory computer-readable storage media such as portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, etc.

[0125] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.

[0126] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (ROM), flash memory, erasable read-only memory (EROM), floppy disks, compact disc read-only memory (CD-ROM), optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0127] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0128] The aspects of this application have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by dedicated hardware performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0129] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.

Claims

1. A single-page application search method, characterized in that, Applied to a multi-user cloud service environment, wherein the environment includes a gateway and multiple user agent servers, and each user's application resources are deployed in an independent user environment, the method includes: Receive requests from the gateway to access user application resources; By calling the user routing component to mark the request, a marked request is obtained to request the resource pointed to by the link from the target user agent server; Check the target user's rendering result cache to see if it contains the target user's rendering result; If the target user's rendering result is not included in the target user's rendering result cache, the tagging request is sent to the target user's proxy server. Receive the target user's single-page application's HTML file and data resources sent by the target user's agent server; The target user agent server request link is inspected by invoking a content filter; and the target resources pointed to by the target user agent server request link are filtered by the content filter, including images, videos and Cascading Style Sheets (CSS) files; If the target user agent server request link does not include the target link, the HTML file is parsed by calling the HTML parser to obtain the Document Object Model (DOM) tree, and the JavaScript file that the HTML file depends on is loaded; wherein, the target link is a dangerous link or a link that is harmful to the target user; By calling the JavaScript engine to execute the JavaScript file, the corresponding nodes in the DOM tree are replaced with the target user's HTML file and the data resources, generating the first static HTML resource; By calling the anchor resolver, the anchor links in the first static HTML resource that are not recognized by the web crawler and are used for navigation within a single-page application are replaced with non-anchor links with corresponding independent Uniform Resource Locators that are recognized by the web crawler, thus obtaining the second static HTML resource; wherein, the anchor links are based on fragment identifiers to implement in-page routing. Send the second static HTML resource to the gateway for the search engine crawler to identify; Write the first static HTML resource into the rendering result cache area of ​​the corresponding target user.

2. The single-page application search method according to claim 1, characterized in that, After writing the first static HTML resource into the rendering result cache of the corresponding target user, the method further includes: The storage time of the target user's rendering result cache in the target user rendering result cache area is detected. If the storage time is greater than a preset threshold, the target user rendering result cache is deleted.

3. A single-page application search device, characterized in that, For use in a multi-user cloud service environment, the environment including a gateway and multiple user agent servers, where each user's application resources are deployed in an independent user environment, the device includes: The server-side renderer receives requests from the gateway to access user application resources; it marks the requests by calling the user routing component to obtain a marked request for requesting a link to a resource from the target user proxy server; it queries the target user's rendering result cache to see if the target user's rendering result is included; if the target user's rendering result is not included in the target user's rendering result cache, it sends the marked request to the target user proxy server. The server-side renderer is used to receive the target user's single-page application's Hypertext Markup Language (HTML) files and data resources sent by the target user's proxy server; A content filter is used to inspect the target user proxy server request link and filter the target resource pointed to by the target user proxy server request link. The filtered content includes images, videos and Cascading Style Sheets (CSS) files. If the target user agent server request link does not include the target link, the HTML parser is used to parse the HTML file, obtain the Document Object Model (DOM) tree, and load the JavaScript file that the HTML file depends on; wherein the target link is a dangerous link or a link that is harmful to the target user. A JavaScript engine is used to execute the JavaScript file to replace the corresponding nodes in the DOM tree with the target user's HTML file and the data resources, thereby generating a first static HTML resource; An anchor resolver is used to replace the anchor links in the first static HTML resource that are not recognizable by web crawlers and are used for navigation within a single-page application with non-anchor links that are recognizable by web crawlers and correspond to independent Uniform Resource Locators, thereby obtaining the second static HTML resource; wherein, the anchor links are based on fragment identifiers to implement in-page routing; and a server-side renderer is used to send the second static HTML resource to the gateway for recognition by search engine crawlers. A server-side renderer is used to write the first static HTML resource into the rendering result cache area of ​​the corresponding target user.

4. A single-page application search device, characterized in that, The device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the steps of the single-page application search method as described in any one of claims 1-2.

5. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions that, when executed by a processor, implement the steps of the single-page application search method as described in any one of claims 1-2.

6. A computer program product, characterized in that, When the instructions in the computer program product are executed by the processor of the electronic device, the electronic device performs the steps of the single-page application search method as described in any one of claims 1-2.