A page loading method and device

By using div elements and program isolators in browser pages to isolate sub-applications from portal page programs, the bloated software program and performance problems caused by iFrame containers are solved and the performance of front-end applications is improved.

CN112597412BActive Publication Date: 2024-09-27AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011569129.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-26
Publication Date
2024-09-27
Estimated Expiration
2040-12-26

AI Technical Summary

Technical Problem

In browser pages, when using iFrame elements as application containers, the complete software program of the HTML page is written into the iFrame container, resulting in a bloated software program that takes up too much memory and bandwidth, affecting the running performance of front-end applications.

Method used

Use the div element in the HTML page as the application container, and use program isolators (such as script isolators and style isolators) to isolate sub-applications and portal page software programs to avoid portal page software programs from contaminating sub-applications and only separate sub-applications. The program writes to the div container.

Benefits of technology

By using div elements and program isolators, duplication and pollution of software programs are avoided, memory and bandwidth usage are reduced, and the running performance of front-end applications is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112597412B
    Figure CN112597412B
Patent Text Reader

Abstract

The present application discloses a page loading method, when a user triggers a first operation requesting access to a first service on a portal page, the terminal device responds to the first operation and obtains a software program and a program isolator corresponding to the first service. The software program corresponding to the first service uses a div element in a hypertext markup language HTML page as an application container. When a user requests access to the first service, the software program corresponding to the first service obtained by the terminal device uses a div element as an application container and only contains the first service, but does not include the software program corresponding to the portal page. After obtaining the software program and the program isolator corresponding to the first service, the terminal device displays the first page corresponding to the first service on the portal page according to the obtained software program and the program isolator.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of Hyper Text Markup Language (HTML), and in particular to a page loading method and device. Background Art

[0002] Currently, in the front-end architecture of a browser page, a unified portal page is usually set up, through which users can access other sub-pages. A portal page is a website that provides a single point of access to software programs and information. It refines the complex and diverse information and services provided to users and simplifies them into a single interface that meets user needs and interests. It is a user interface architecture for integrating other sub-applications, content, and processes. In the case where the portal page and other sub-pages are displayed on the same browser page, developers usually centrally develop, test, and deploy the software programs of the portal page and other sub-pages in the same project. This setting usually makes the product release process cumbersome and causes problems such as system instability.

[0003] In order to avoid writing the software programs of the portal page and other sub-pages in the same project, the developer uses the iFrame element in the HTML page as the application container, and writes the software programs of each sub-page into the iFrame container, so that the software programs of each sub-page are isolated from the software programs corresponding to the portal page. However, according to the rules of the iFrame container, what is written into the iFrame container is the complete software program of a certain HTML page, that is, in an iFrame container, in addition to the software program of a certain sub-page, there will also be the software program corresponding to the portal page, which makes the software program corresponding to the portal page appear repeatedly in each iFrame container, causing the software program to be bloated, thereby occupying more memory and bandwidth, and affecting the running performance of the front-end application.

[0004] Therefore, a solution is urgently needed to solve the above problems. Summary of the invention

[0005] The technical problem to be solved by the present application is to provide a page loading method to solve the problems of bloated software program, excessive memory and bandwidth usage, and poor front-end application running performance caused by using the iFrame element in the HTML page as an application container and writing the complete software program of the HTML page into the iFrame container.

[0006] In a first aspect, an embodiment of the present application provides a page loading method, the method comprising:

[0007] In response to a first operation triggered by a user on a portal page, obtaining a software program and a program isolator corresponding to a first service, wherein the first operation is used to request access to the first service;

[0008] According to the acquired software program and the program isolator, a first page corresponding to the first business is displayed on the portal page; wherein:

[0009] The software program corresponding to the first service uses a div element in a hypertext markup language HTML page as an application container, and the program isolator is used to isolate the software program corresponding to the first service from the software program corresponding to the portal page.

[0010] Optionally, the program isolator includes:

[0011] A script isolator, and / or a style isolator; where:

[0012] The script isolator is used to isolate software programs written in JavaScript, and the style isolator is used to isolate software programs written in Cascading Style Sheets (CSS).

[0013] Optionally, the script isolator includes a global variable agent, which is used to obtain a modification operation on the global variable and modify a backup variable of the global variable according to the modification operation, and the modified value of the backup variable is used to load the first page; wherein:

[0014] The global variable is a variable that needs to be set when loading the portal page and the first page.

[0015] Optionally, the script isolator includes a global variable snapshot, and displaying a first page corresponding to the first business on the portal page includes:

[0016] Modifying the value of a global variable in a software program corresponding to the portal page, so as to display a first page corresponding to the first service on the portal page;

[0017] The method further comprises:

[0018] After exiting the first page, restoring the value of the global variable in the software program corresponding to the portal page using the global variable snapshot, wherein the restored value of the global variable is equal to the global variable snapshot;

[0019] in:

[0020] The global variable is a variable that needs to be set when loading the portal page and the first page.

[0021] Optionally, the style isolator uses a shadow document structure model DOM as a sub-application container.

[0022] In a second aspect, an embodiment of the present application provides a page loading device, the device comprising:

[0023] An acquisition module, configured to: acquire a software program and a program isolator corresponding to a first service in response to a first operation triggered by a user on a portal page, wherein the first operation is used to request access to the first service;

[0024] A display module, configured to: display a first page corresponding to the first service on the portal page according to the acquired software program and the program isolator;

[0025] in:

[0026] The software program corresponding to the first service uses a div element in a hypertext markup language HTML page as an application container, and the program isolator is used to isolate the software program corresponding to the first service from the software program corresponding to the portal page.

[0027] Optionally, the program isolator includes:

[0028] A script isolator, and / or a style isolator; where:

[0029] The script isolator is used to isolate software programs written in JavaScript, and the style isolator is used to isolate software programs written in Cascading Style Sheets (CSS).

[0030] Optionally, the script isolator includes a global variable agent, which is used to obtain a modification operation on the global variable and modify a backup variable of the global variable according to the modification operation, and the modified value of the backup variable is used to load the first page; wherein:

[0031] The global variable is a variable that needs to be set when loading the portal page and the first page.

[0032] Optionally, the script isolator includes a global variable snapshot, and the display module is used to:

[0033] Modifying the value of a global variable in a software program corresponding to the portal page, so as to display a first page corresponding to the first service on the portal page;

[0034] The device also includes:

[0035] A recovery module, used to: after exiting the first page, use the global variable snapshot to restore the value of the global variable in the software program corresponding to the portal page, so that the value of the global variable after restoration is equal to the global variable snapshot;

[0036] in:

[0037] The global variable is a variable that needs to be set when loading the portal page and the first page.

[0038] Optionally, the style isolator uses a shadow document structure model DOM as a sub-application container.

[0039] Compared with the prior art, the embodiments of the present application have the following advantages:

[0040] The embodiment of the present application provides a page loading method, when a user triggers a first operation requesting access to a first service on a portal page, a terminal device responds to the first operation and obtains a software program and a program isolator corresponding to the first service. The software program corresponding to the first service uses a div element in an HTML page as an application container. According to the rule of the div container, a software program of a sub-application may be written into the div container. Therefore, when a software program of a sub-application of an HTML page is written into the div container, only a software program of a sub-application of the HTML page may be written into the div container, and the software program corresponding to the portal page of the HTML page may not be written into the div container. In other words, when a user requests access to the first service, the software program corresponding to the first service obtained by the terminal device uses a div element as an application container, only contains the first service, and does not include the software program corresponding to the portal page. In order to prevent the software program corresponding to the first service from contaminating the software program corresponding to the portal page, the program isolator may be used to isolate the software program corresponding to the first service from the software program corresponding to the portal page. After obtaining the software program corresponding to the first service and the program isolator, the terminal device displays the first page corresponding to the first service on the portal page according to the obtained software program and the program isolator. It can be seen that by using the div element in the HTML page as an application container, only the software program of a sub-application of the HTML page is written into the div container, and the software program corresponding to the portal page of the HTML page is not written into the div container. At the same time, a program isolator is used to prevent the software program corresponding to the first business from contaminating the software program corresponding to the portal page. This can solve the problems of bloated software programs, excessive memory and bandwidth usage, and poor front-end application running performance caused by writing the complete software program of the HTML page into the iFrame container when using the iFrame element in the HTML page as an application container. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0042] Figure 1 A schematic diagram of a page loading method in an embodiment of the present application;

[0043] Figure 2This is a schematic diagram of the structure of a page loading device in an embodiment of the present application. DETAILED DESCRIPTION

[0044] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0045] The inventor of the present application has found through research that, currently, in order to avoid writing the software programs of the portal page and other sub-pages in the same project, developers usually use the iFrame element in the HTML page as an application container, write the software programs of each sub-page into the iFrame container, so that the software programs of each sub-page are isolated from the software programs corresponding to the portal page. However, according to the rules of the iFrame container, what is written into the iFrame container is the complete software program of a certain HTML page, that is, in an iFrame container, in addition to the software program of a certain sub-page, there will also be the software program corresponding to the portal page, which makes the software program corresponding to the portal page appear repeatedly in each iFrame container, causing the software program to be bloated, thereby occupying more memory and bandwidth, and affecting the running performance of the front-end application.

[0046] In order to solve the above problem, in an embodiment of the present application, when a user triggers a first operation requesting access to a first service on a portal page, the terminal device responds to the first operation and obtains a software program and a program isolator corresponding to the first service. The software program corresponding to the first service uses a div element in an HTML page as an application container. According to the rules of the div container, a software program of a sub-application may be written into the div container. Therefore, when a software program of a sub-application of an HTML page is written into a div container, only a software program of a sub-application of the HTML page may be written into the div container, and the software program corresponding to the portal page of the HTML page may not be written into the div container. In other words, when a user requests access to the first service, the software program corresponding to the first service obtained by the terminal device uses a div element as an application container, only contains the first service, and does not include the software program corresponding to the portal page. In order to prevent the software program corresponding to the first service from contaminating the software program corresponding to the portal page, the program isolator may be used to isolate the software program corresponding to the first service from the software program corresponding to the portal page. After obtaining the software program corresponding to the first service and the program isolator, the terminal device displays the first page corresponding to the first service on the portal page according to the obtained software program and the program isolator. It can be seen that by using the div element in the HTML page as an application container, only the software program of a sub-application of the HTML page is written into the div container, and the software program corresponding to the portal page of the HTML page is not written into the div container. At the same time, a program isolator is used to prevent the software program corresponding to the first business from contaminating the software program corresponding to the portal page. This can solve the problems of bloated software programs, excessive memory and bandwidth usage, and poor front-end application running performance caused by writing the complete software program of the HTML page into the iFrame container when using the iFrame element in the HTML page as an application container.

[0047] Various non-limiting implementations of the present application are described in detail below in conjunction with the accompanying drawings.

[0048] Exemplary Methods

[0049] See also Figure 1 , showing a flow chart of a page loading method in an embodiment of the present application. Figure 1 The method shown, in one implementation, may be executed by a terminal device.

[0050] In this embodiment, Figure 1 The method shown can be implemented, for example, through the following steps S101 - S102 .

[0051] S101: In response to a first operation triggered by a user on a portal page, a software program and a program isolator corresponding to a first business are obtained, wherein the first operation is used to request access to the first business; wherein the software program corresponding to the first business uses a div element in an HTML page as an application container, and the program isolator is used to isolate the software program corresponding to the first business from the software program corresponding to the portal page.

[0052] In this embodiment, when the user triggers a first operation requesting access to a first service on a portal page, the terminal device responds to the first operation and obtains a software program and a program isolator corresponding to the first service. The software program corresponding to the first service uses a div element in an HTML page as an application container.

[0053] It is understandable that, according to the rules of the div container, what is written into the div container may be a software program of a sub-application. Therefore, when writing the software program of the sub-application of the HTML page into the div container, only the software program of the sub-application of the HTML page may be written into the div container, and the software program corresponding to the portal page of the HTML page may not be written into the div container. In other words, when the user requests to access the first service, the software program corresponding to the first service obtained by the terminal device is a software program that uses the div element as an application container and only contains the first service, but does not include the software program corresponding to the portal page.

[0054] In order to prevent the software program corresponding to the first business from contaminating the software program corresponding to the portal page, the program isolator can be used to isolate the software program corresponding to the first business from the software program corresponding to the portal page. In one example, the program isolator includes a script isolator and / or a style isolator. The script isolator is used to isolate software programs written in JavaScript (usually abbreviated as JS), and the style isolator is used to isolate software programs written in Cascading Style Sheets (CSS).

[0055] By using the div element in the HTML page as an application container, only the software program of a sub-application of the HTML page is written into the div container, while the software program corresponding to the portal page of the HTML page is not written into the div container. At the same time, a program isolator is used to prevent the software program corresponding to the first business from contaminating the software program corresponding to the portal page. This can solve the problems of bloated software programs, excessive memory and bandwidth usage, and poor front-end application running performance caused by writing the complete software program of the HTML page into the iFrame container when using the iFrame element in the HTML page as an application container.

[0056] When the program isolator is used to isolate the software program corresponding to the first service and the software program corresponding to the portal page, it can be understood that the software program corresponding to the first service also needs to set the global variables in the software program corresponding to the portal page. Among them, the global variables are variables that need to be set when loading both the portal page and the first page. For example, assuming that the global variable "font color" is set to "a" in the software program corresponding to the portal page, the first service may also set the specific value of the variable "font color". Since the software program corresponding to the first service does not include the software program corresponding to the portal page, it also does not include the variables in the software program corresponding to the portal page, such as the variable "font color" "a". When the software program corresponding to the first service needs to use the variable "a", the variable "a" can be set to be the same as the variable "a" in the software program corresponding to the portal page, or the variable "a" can be set to be different from the variable "a" in the software program corresponding to the portal page. In order to ensure that the global variables used in the software program corresponding to the first business, such as variable "a", do not affect the variable "a" set in the software program corresponding to the portal page, when the program isolator is the script isolator, the script isolator can be set to include a global variable proxy or a global variable snapshot; when the program isolator is the style isolator, the style isolator can be set to use a shadow document structure model (Shadow Document Object Model, shadow-dom) as a sub-application container.

[0057] When the program isolator is the script isolator, and the script isolator includes the global variable agent, the global variable agent is used to obtain the modification operation of the global variable, and modify the backup variable of the global variable according to the modification operation, and the value of the modified backup variable is used to load the first page. For example, the "font color" is set to the global variable "a", and the value of the variable "a" in the software program corresponding to the portal page is "red". If you want to set the font color of the first page to yellow, at this time, the software program corresponding to the first business calls the variable "a" and modifies the value of the variable "a" to "yellow". In order to avoid modifying the variable "a" in the software program corresponding to the portal application to yellow, the modification operation of the variable "a" can be obtained through the global variable agent, that is, the modification operation of "changing red to yellow" is obtained, and the backup variable of the variable "a" is modified according to the modification operation. The value of the backup variable of the modified variable "a" is "yellow", and the value of the backup variable of the variable "a" is used to load the first page, so that the font color of the first page is displayed as yellow.

[0058] When the program isolator is the script isolator, and the script isolator includes the global variable snapshot, the value of the global variable in the software program corresponding to the portal page can be modified, and then the first page corresponding to the first business can be displayed on the portal page. After exiting the first page, the value of the global variable in the software program corresponding to the portal page is restored using the global variable snapshot, and the value of the restored global variable is equal to the global variable snapshot. In other words, before modifying the value of the global variable in the software program corresponding to the portal page, the global variable snapshot saves the value of the global variable in the software program corresponding to the current portal page, so the value of the global variable in the software program corresponding to the portal page can be directly modified, and then the first page corresponding to the first business can be displayed on the portal page. After exiting the first page, the value of the global variable in the software program corresponding to the portal page is restored using the global variable snapshot, so that the value of the restored global variable is equal to the global variable snapshot. Through this method, the specific value of the global variable set in the software program corresponding to the portal page will not be affected.

[0059] When the program isolator is the style isolator, and the style isolator uses shadow-dom as a sub-application container, the steps for the style isolator to isolate the software program corresponding to the first business and the software program corresponding to the portal page are as follows: First, the style isolator generates a shadow-dom element, adds the dynamic script and style resources of the first business to it, and then loads the style of the first business in the style isolator. When the first business is about to be destroyed, the style isolator destroys the shadow-dom element therein.

[0060] S102: Displaying a first page corresponding to the first business on the portal page according to the acquired software program and the program isolator.

[0061] In this embodiment, after acquiring the software program and the program isolator corresponding to the first service, the terminal device displays the first page corresponding to the first service on a portal page according to the acquired software program and the program isolator.

[0062] Exemplary Devices

[0063] Based on the method provided in the above embodiment, the embodiment of the present application further provides a device, which is described below in conjunction with the accompanying drawings.

[0064] See also Figure 2, shows a schematic diagram of the structure of a page loading device in an embodiment of the present application. Applied to a terminal device, the device may specifically include:

[0065] Acquisition module 201: used to acquire a software program and a program isolator corresponding to a first service in response to a first operation triggered by a user on a portal page, wherein the first operation is used to request access to the first service;

[0066] in:

[0067] The software program corresponding to the first service uses a div element in a hypertext markup language HTML page as an application container, and the program isolator is used to isolate the software program corresponding to the first service from the software program corresponding to the portal page;

[0068] Display module 202: configured to display a first page corresponding to the first service on the portal page according to the acquired software program and the program isolator;

[0069] This device can solve the problems of using the iFrame element in the HTML page as an application container and writing the complete software program of the HTML page into the iFrame container, such as bloated software program, excessive memory and bandwidth usage, and poor front-end application running performance.

[0070] In one implementation, the program isolator includes:

[0071] A script isolator, and / or a style isolator; where:

[0072] The script isolator is used to isolate software programs written in JavaScript, and the style isolator is used to isolate software programs written in Cascading Style Sheets (CSS).

[0073] In one implementation, the script isolator includes a global variable agent, which is used to obtain a modification operation on the global variable and modify a backup variable of the global variable according to the modification operation, and the modified value of the backup variable is used to load the first page; wherein:

[0074] The global variable is a variable that needs to be set when loading the portal page and the first page.

[0075] In one implementation, the script isolator includes a global variable snapshot, and the display module is used to:

[0076] Modifying the value of a global variable in a software program corresponding to the portal page, so as to display a first page corresponding to the first service on the portal page;

[0077] The device also includes:

[0078] A recovery module, used to: after exiting the first page, use the global variable snapshot to restore the value of the global variable in the software program corresponding to the portal page, so that the value of the global variable after restoration is equal to the global variable snapshot;

[0079] in:

[0080] The global variable is a variable that needs to be set when loading the portal page and the first page.

[0081] In one implementation, the style isolator uses a shadow document structure model DOM as a sub-application container.

[0082] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0083] It should be understood that the present application is not limited to the precise structures described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

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

Claims

1. A page loading method, characterized in that: The method comprises: In response to a first operation triggered by a user on a portal page, obtaining a software program and a program isolator corresponding to a first service, wherein the first operation is used to request access to the first service; According to the acquired software program and the program isolator, a first page corresponding to the first business is displayed on the portal page; wherein: The software program corresponding to the first service uses a div element in a hypertext markup language HTML page as an application container, and the program isolator is used to isolate the software program corresponding to the first service from the software program corresponding to the portal page; The program isolator includes a script isolator, which is used to isolate software programs written in JavaScript, and the script isolator includes a global variable agent, which is used to obtain a modification operation on a global variable and modify a backup variable of the global variable according to the modification operation, and the modified value of the backup variable is used to load the first page; wherein: The global variable is a variable that needs to be set when loading the portal page and the first page.

2. The method according to claim 1, characterized in that The program isolator also includes a style isolator, which is used to isolate software programs written in cascading style sheets (CSS).

3. The method according to claim 1, characterized in that The script isolator further includes a global variable snapshot, and displays a first page corresponding to the first business on the portal page, including: Modifying the value of a global variable in a software program corresponding to the portal page, so as to display a first page corresponding to the first service on the portal page; The method further comprises: After exiting the first page, the value of the global variable in the software program corresponding to the portal page is restored using the global variable snapshot, and the restored value of the global variable is equal to the global variable snapshot.

4. The method according to claim 2, characterized in that: The style isolator uses the shadow document structure model DOM as a sub-application container.

5. A page loading device, characterized in that: The device comprises: An acquisition module, configured to: acquire a software program and a program isolator corresponding to a first service in response to a first operation triggered by a user on a portal page, wherein the first operation is used to request access to the first service; A display module, configured to: display a first page corresponding to the first service on the portal page according to the acquired software program and the program isolator; in: The software program corresponding to the first service uses a div element in a hypertext markup language HTML page as an application container, and the program isolator is used to isolate the software program corresponding to the first service from the software program corresponding to the portal page; The program isolator includes a script isolator, which is used to isolate software programs written in JavaScript. The script isolator includes a global variable agent, which is used to obtain a modification operation on a global variable and modify a backup variable of the global variable according to the modification operation. The modified value of the backup variable is used to load the first page; wherein: The global variable is a variable that needs to be set when loading the portal page and the first page.

6. The device according to claim 5, characterized in that The program isolator also includes a style isolator, which is used to isolate software programs written in cascading style sheets (CSS).

7. The device according to claim 5, characterized in that The script isolator also includes a global variable snapshot, the display module, for: Modifying the value of a global variable in a software program corresponding to the portal page, so as to display a first page corresponding to the first service on the portal page; The device also includes: The recovery module is used to: after exiting the first page, use the global variable snapshot to restore the value of the global variable in the software program corresponding to the portal page, and the value of the restored global variable is equal to the global variable snapshot.

8. The device according to claim 6, characterized in that The style isolator uses the shadow document structure model DOM as a sub-application container.