Loading technology architecture for optimizing first screen user experience of html5 page
Patent Information
- Application Number
- CN202410711682.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-03
- Publication Date
- 2024-08-30
AI Technical Summary
The existing HTML5 page loading technology results in slow page opening speed and poor user experience. Especially when the network environment is poor, it is prone to problems such as content confusion, screen splashing and resource waste.
By dividing the first screen content of the HTML5 page into multiple sub-modules, using JavaScript to monitor user operation behavior, load the content of each module on demand to ensure that the first screen content is rendered sequentially, and load content outside the first screen after the user scrolls or clicks, reducing inconsistency. Necessary resource consumption.
It has improved the loading speed of the first screen of HTML5 pages, optimized user experience, reduced traffic consumption and loading time, and improved user browsing time and commercial data conversion rate.
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of HTML5 pages, and specifically is a loading technology architecture for optimizing the user experience of the first screen of an HTML5 page. Background Art
[0002] Internet technology is constantly developing, and mobile users' requirements for HTML5 pages are also increasing. From the initial simple information browsing, gradually increasing page operation interaction, to complex dynamic interaction and display effects, developers can no longer simply realize page display from the purpose of completing the required functions. While completing the functions, they also need to consider better implementation solutions from the perspective of user experience, so that users can browse and operate the page content smoothly, comfortably and energy-savingly, thereby retaining more potential customers and achieving higher order conversion rates.
[0003] Using Html5 pages to display special content and product content to customers is a technical solution used by most Internet companies. The common practice of existing HTML5 web pages is to load the data required for the page and the DOM element content one by one on the server side, generate a complete HTML structure, output it to the client and render it as web page content, and display it to the user. This method uses the page content solution loaded on the server side, which will cause the page to open slowly, because in the process of combining the required data on the server side, the client is in a waiting state, and the user sees a white screen content, or the data is not loaded on the server side. The data API required by each module is asynchronously loaded in the page through JavaScript technology, and asynchronous loading is adopted. The advantage is that it is non-blocking. The content of the module whose API request gets the return result first will be displayed first. However, the disadvantage is that there is no order of priority, which makes the content displayed to the user have no order and is rather messy. In addition, since the loading speed of HTML5 depends on the network speed, in the case of a poor network environment, the page content is prone to confusion, screen flashing, expansion or contraction, and the user experience gives people a very messy feeling, which can easily lead to the loss of potential customers. Moreover, in the existing web page development process, the basic approach is to completely load the entire page content data when the user opens the web page, without considering whether the user really wants to scroll down to browse the content beyond the first screen, which is a great waste of network resources, so it needs to be improved. Summary of the invention
[0004] In view of the deficiencies in the prior art, the present invention provides a loading technology architecture for optimizing the user experience of the first screen of an HTML5 page, which has the advantages of fast first screen loading speed and smooth browsing.
[0005] To achieve the above purpose, the present invention provides the following technical solution: a loading technology architecture for optimizing the user experience of the first screen of an HTML5 page, the specific steps are as follows:
[0006] Step 1: First screen loading order
[0007] Assume that the content of the first screen of the page is divided into 5 sub-modules, define an array [sub-module 1, sub-module 2, sub-module 3, sub-module 4, sub-module 5], and the 5 elements in the array indicate whether the API request in the corresponding module has been loaded. After each sub-module requests the interface and successfully returns data, notify the main page and delete the corresponding module identifier in the array. Monitor the number of identifiers in the array in real time on the first screen to see if it is 0. The array length of 0 means that all important data of the sub-modules have been loaded, and the page content can be rendered in sequence. The page that the user sees at the current time is the content rendered from top to bottom, and there will be no jitter, flickering, module confusion, and content interlacing.
[0008] Step 2: First screen loading speed
[0009] Assume that the page has a lot of content. There is a lot of information and product lists outside the first screen when you scroll down. When you click a button, there is dynamic data content in the pop-up layer. However, if the data outside the first screen is loaded when the page is just opened, there will be three problems:
[0010] 1: It affects the response speed of the page when it is opened for the first time. If the network environment is not good, it takes a long time to wait;
[0011] 2: All content other than the first screen may not be what the user wants to browse, but it is also loaded all at once;
[0012] 3: In the mobile network environment, it consumes more user traffic;
[0013] To solve the above problems, we use JavaScript technology to monitor user operation behaviors, obtain the user's click and web page scrolling operation identifiers after the first screen is loaded, and then load content other than the first screen, thereby solving the above three problems.
[0014] Preferably, the submodules described in step one are obtained by splitting the first screen content of the HTML5 webpage into modules, and recording the split submodule identifiers into a global array variable.
[0015] Preferably, in step one, the API interface request for key data is found in the submodule, and after the API interface is executed, no matter whether the API interface is executed successfully or failed.
[0016] Preferably, after the submodule described in step one requests the interface and successfully returns data, the main page hook function is called, in which the corresponding submodule call parameters are obtained, and the corresponding elements are deleted from the module identification array.
[0017] Preferably, in step one, a calculation property is created to calculate whether all sub-module API interfaces in the sub-module identification array have been loaded. The unloaded sub-module identifications are still in the array, and the length is 0, which means that all sub-module interfaces have been loaded. Then, the content of each sub-module is rendered in turn and displayed to the user.
[0018] Preferably, when the first screen described in step 2 is loaded too slowly and the interface call pending times out, the sub-module identification array contents are cleared 1500 milliseconds after the web page is initialized, and the first screen page contents are forcibly displayed, regardless of whether the current page content is missing.
[0019] Preferably, whether the content outside the first screen described in step 2 is displayed can be controlled by creating a global boolean variable isStartToScroll in the main page to control whether the content outside the first screen is displayed. After the page is initialized, the user's scrolling events and click events are listened to. After the user triggers the scrolling or clicking event, the boolean variable isStartToScroll is set to true. After the isStartToScroll variable is true, the content module outside the first screen starts to request the API interface in sequence, and after obtaining the requested data, it is rendered to the page for display to the user for browsing.
[0020] Preferably, the submodule described in step 1 can operate on the loaded submodule array identifier in real time by using the stack push and stack pop methods.
[0021] Preferably, the content outside the first screen described in step 2 can be monitored by the user's scrolling and clicking operations to determine whether the content outside the first screen needs to be loaded. After the user triggers the operation for the first time, the content module outside the first screen requests the corresponding data interface and renders the content data.
[0022] Compared with the prior art, the present invention has the following beneficial effects:
[0023] This patent provides a solution to the problems of disordered, flickering, disordered, content-heavy, slow, and high traffic consumption loading of HTML5 web pages. Through front-end JS technical means, a whole page of content is divided into several modules. According to the actual user operation, the content of each module is loaded on demand, so as to achieve the purpose of accelerating the first screen of HTML5 web pages, smooth browsing, and improving user experience, thereby increasing the browsing time of potential users and improving the conversion rate of commercial data. DETAILED DESCRIPTION
[0024] Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making any creative work shall fall within the scope of protection of the present invention.
[0025] The present invention provides a technical solution: a loading technology architecture for optimizing the user experience of the first screen of an HTML5 page, and the specific steps are as follows:
[0026] Step 1: First screen loading order
[0027] Assume that the content of the first screen of the page is divided into 5 sub-modules, define an array [sub-module 1, sub-module 2, sub-module 3, sub-module 4, sub-module 5], and the 5 elements in the array indicate whether the API request in the corresponding module has been loaded. After each sub-module requests the interface and successfully returns data, notify the main page and delete the corresponding module identifier in the array. Monitor the number of identifiers in the array in real time on the first screen to see if it is 0. The array length of 0 means that all important data of the sub-modules have been loaded, and the page content can be rendered in sequence. The page that the user sees at the current time is the content rendered from top to bottom, and there will be no jitter, flickering, module confusion, and content interlacing.
[0028] Step 2: First screen loading speed
[0029] Assume that the page has a lot of content. There is a lot of information and product lists outside the first screen when you scroll down. When you click a button, there is dynamic data content in the pop-up layer. However, if the data outside the first screen is loaded when the page is just opened, there will be three problems:
[0030] 1: It affects the response speed of the page when it is opened for the first time. If the network environment is not good, it takes a long time to wait;
[0031] 2: All content other than the first screen may not be what the user wants to browse, but it is also loaded all at once;
[0032] 3: In the mobile network environment, it consumes more user traffic;
[0033] To solve the above problems, we use JavaScript technology to monitor user operation behaviors, obtain the user's click and web page scrolling operation identifiers after the first screen is loaded, and then load content other than the first screen, thereby solving the above three problems.
[0034] Through JavaScript technology, the API request results in each child DOM element are monitored, and the hiding and display of DOM elements are dynamically controlled to provide users with a better browsing experience visually. In addition, the monitoring of user scrolling and click operations is added to control the loading timing of content outside the first screen, and load it when the user really needs it, so that the first screen content can load faster and save user traffic resources.
[0035] The submodules in step one are obtained by splitting the first screen content of the HTML5 webpage into modules, and the identifiers of the split submodules are recorded in the global array variable.
[0036] By splitting the first screen of an HTML5 web page into multiple sub-modules, the content of each module can be loaded on demand, thereby increasing the loading speed of the web page.
[0037] Among them, in step one, the API interface request for key data is found in the sub-module. After the API interface is executed, no matter whether the API interface is executed successfully or failed.
[0038] By calling back after the API interface is executed, you can ensure that the main page will proceed to the next step only after receiving all necessary data.
[0039] Among them, after the sub-module in step one requests the interface and successfully returns data, the main page hook function is called. In the main page hook function, the corresponding sub-module calling parameters are obtained, and the corresponding elements in the module identification array are deleted.
[0040] By deleting the elements of the corresponding sub-modules in the module identification array, the status of which sub-modules' API interfaces have been loaded is updated and maintained in real time.
[0041] Among them, in step one, by creating a calculated attribute, the calculation sub-module identification array is calculated to see whether all sub-module API interfaces have been loaded. The unloaded sub-module identifications are still in the array, and the length of 0 represents that all sub-module interfaces have been loaded. Then, the content of each sub-module is rendered in turn and displayed to the user.
[0042] By tracking the loading status of sub-modules in real time and rendering the page content after all sub-modules are loaded, it ensures that users can quickly see a complete and loaded page, improving the user experience.
[0043] Among them, when the first screen loads too slowly in step 2 and the interface call pending times out, the sub-module identification array contents are cleared after 1500 milliseconds of web page initialization, and the first screen page content is forced to be displayed, regardless of whether the current page content is missing.
[0044] By setting a timeout, when the loading time exceeds the timeout, the first screen page content is forced to be displayed to the user. In this way, the user can see the content of the page at the first time instead of seeing a blank page or loading prompt, thereby improving the user experience.
[0045] Among them, whether the content outside the first screen in step 2 is displayed can be controlled by creating a global boolean variable isStartToScroll in the main page to control whether the content outside the first screen is displayed. After the page is initialized, the user's scrolling events and click events are listened to. After the user triggers the scrolling or clicking event, the boolean variable isStartToScroll is set to true. After the isStartToScroll variable is true, the content module outside the first screen starts to request the API interface in sequence, and after obtaining the requested data, it is rendered to the page for the user to browse.
[0046] By monitoring user scrolling and click events, it is possible to determine whether to load content beyond the first screen, thereby reducing user traffic consumption.
[0047] Among them, the sub-module in step 1 can operate the loaded sub-module array identifier in real time by using the stack push and stack pop methods.
[0048] By operating the array identifiers of loaded sub-modules in real time, and then obtaining the remaining number of unloaded items in real time through calculated properties, until all the contents of the sub-modules are loaded, the contents of the first screen are displayed in sequence.
[0049] Among them, the content outside the first screen in step 2 can be monitored by the user's scrolling and clicking operations to determine whether the content outside the first screen needs to be loaded. After the user triggers the operation for the first time, the content module outside the first screen requests the corresponding data interface and renders the content data.
[0050] This can determine whether to load content outside the first screen, thereby accelerating the display of user first screen content and saving user network resources.
[0051] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0052] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A loading technology architecture for optimizing the user experience of the first screen of an HTML5 page, characterized by: The specific steps are as follows: Step 1: First screen loading order Assume that the content of the first screen of the page is divided into 5 sub-modules, define an array [sub-module 1, sub-module 2, sub-module 3, sub-module 4, sub-module 5], and the 5 elements in the array indicate whether the API request in the corresponding module has been loaded. After each sub-module requests the interface and successfully returns data, notify the main page and delete the corresponding module identifier in the array. Monitor the number of identifiers in the array in real time on the first screen to see if it is 0. The array length of 0 means that all important data of the sub-modules have been loaded, and the page content can be rendered in sequence. The page that the user sees at the current time is the content rendered from top to bottom, and there will be no jitter, flickering, module confusion, and content interlacing. Step 2: First screen loading speed Assume that the page has a lot of content. There is a lot of information and product lists outside the first screen when you scroll down. When you click a button, there is dynamic data content in the pop-up layer. However, if the data outside the first screen is loaded when the page is just opened, there will be three problems: 1: It affects the response speed of the page when it is opened for the first time. If the network environment is not good, it takes a long time to wait; 2: All content other than the first screen may not be what the user wants to browse, but it is also loaded all at once; 3: In the mobile network environment, it consumes more user traffic; To solve the above problems, we use JavaScript technology to monitor user operation behaviors, obtain the user's click and web page scrolling operation identifiers after the first screen is loaded, and then load content other than the first screen, thereby solving the above three problems.
2. According to claim 1, a loading technology architecture for optimizing the user experience of the first screen of an HTML5 page is characterized by: The submodules described in step one are obtained by splitting the first screen content of the HTML5 webpage into modules, and recording the split submodule identifiers into a global array variable.
3. According to claim 1, a loading technology architecture for optimizing the user experience of the first screen of an HTML5 page is characterized by: In step 1, the API interface request for key data is found in the submodule. After the API interface is executed, whether the API interface is executed successfully or failed.
4. According to claim 1, a loading technology architecture for optimizing the user experience of the first screen of an HTML5 page is characterized by: After the submodule described in step 1 requests the interface and successfully returns data, the main page hook function is called. In the main page hook function, the corresponding submodule call parameters are obtained, and the corresponding elements in the module identification array are deleted.
5. According to claim 1, a loading technology architecture for optimizing the user experience of the first screen of an HTML5 page is characterized by: As described in step 1, by creating a calculated property, calculate whether all sub-module API interfaces in the sub-module identification array have been loaded. The sub-module identifications that have not been loaded are still in the array. The length of 0 represents that all sub-module interfaces have been loaded, and then the content of each sub-module is rendered in turn and displayed to the user.
6. According to claim 1, a loading technology architecture for optimizing the user experience of the first screen of an HTML5 page is characterized by: When the first screen loads too slowly and the interface call pending times out as described in step 2, the submodule identification array contents are cleared after 1500 milliseconds of web page initialization, and the first screen page contents are forced to be displayed, regardless of whether the current page content is missing.
7. According to claim 1, a loading technology architecture for optimizing the user experience of the first screen of an HTML5 page is characterized by: Whether the content outside the first screen described in step 2 is displayed can be controlled by creating a global boolean variable isStartToScroll in the main page to control whether the content outside the first screen is displayed. After the page is initialized, the user's scrolling events and click events are listened to. After the user triggers the scrolling or clicking event, the boolean variable isStartToScroll is set to true. After the isStartToScroll variable is true, the content module outside the first screen starts to request the API interface in sequence, and after obtaining the requested data, it is rendered to the page for the user to browse.
8. According to claim 1, a loading technology architecture for optimizing the user experience of the first screen of an HTML5 page is characterized by: The submodule described in step 1 can operate the loaded submodule array identifier in real time by using the stack push and stack pop methods.
9. According to claim 1, a loading technology architecture for optimizing the user experience of the first screen of an HTML5 page is characterized by: The content outside the first screen described in step 2 can be monitored by the user's scrolling and clicking operations to determine whether the content outside the first screen needs to be loaded. After the user triggers the operation for the first time, the content module outside the first screen requests the corresponding data interface and renders the content data.
Citation Information
Cited By
Page loading method and device, electronic equipment and storage medium
CN121614210A
