A webpage loading method, an electronic device and a readable storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-08
- Publication Date
- 2026-08-11
AI Technical Summary
[0003]但是,当网络环境较差时会影响应用程序中网页的加载
[0031] Thirdly, embodiments of this application provide a readable storage medium storing instructions that, when executed on an electronic device, cause the terminal device to perform the web page loading method provided in the first aspect and various possible implementations of the first aspect.
Smart Images

Figure CN122548060A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communications, and in particular to a web page loading method, an electronic device, and a readable storage medium. Background Technology
[0002] Applications typically display web page content using a WebView, which is a component used in applications to display web page content. For example, news applications can use a WebView to display news article pages.
[0003] However, poor network conditions can affect the loading of web pages in applications. For example, when loading web pages via wireless local area networks (WLANs) (such as Wi-Fi), weak Wi-Fi signals and low Wi-Fi speeds can cause problems; or when loading web pages via cellular networks, congestion and low bandwidth can also lead to poor network conditions. When applications load web pages under these poor network conditions, slow page loading or page loading failures can cause page stuttering, impacting the user experience. Summary of the Invention
[0004] To address the aforementioned issues, embodiments of this application provide a webpage loading method, an electronic device, and a readable storage medium.
[0005] In a first aspect, this application provides a webpage loading method applied to an electronic device, the method comprising: detecting that a first webpage has not been fully loaded within a first time period; optimizing the network of the electronic device in response to the network performance parameters of the electronic device meeting a first condition; and loading the first webpage based on the optimized network.
[0006] It is understood that the first webpage can refer to the webpage displayed by the application in the user interface (UI) of the electronic device; the electronic device can refer to the mobile phone 10 mentioned in the embodiments of this application. In addition, the electronic device can also be other different types of electronic devices, such as laptops, tablets, etc., which are not limited here.
[0007] It is understandable that applications on electronic devices may also include other web pages besides the first web page. These web pages may be cached by the application, expand or supplement the content of the first web page, and can be accessed via internal links in the first web page.
[0008] It is understood that the first duration can refer to the maximum acceptable duration for an application not to refresh or not to fully load. That is, if the loading time of a webpage exceeds this first duration, it can be considered that the loading of the first webpage is lagging, affecting the user experience. In this embodiment, the first duration can be, for example, 2 seconds or less, and this application is not limited thereto. Furthermore, in other embodiments, the first duration can be any value, and this is not limited here.
[0009] Based on the aforementioned webpage loading method, an electronic device can quickly identify a loading lag in the first webpage if it fails to complete loading within a certain timeframe. Furthermore, the device can detect if the lag is caused by poor network performance. The device then optimizes its network and loads the first webpage using the optimized network, thus improving the loading lag issue and enabling the first webpage to load quickly. In this way, the electronic device can detect webpage lag caused by poor network performance in a short time, optimize the network, and ensure rapid loading of the first webpage, reducing the user's perception of webpage lag and improving the user experience.
[0010] In one possible implementation of the first aspect above, detecting that the first webpage has not been fully loaded within a first duration includes: detecting that the electronic device calls the webpage loading method based on the first address of the first webpage at a first moment; determining that the first webpage has not been fully loaded within the first duration based on the fact that no callback of the corresponding first webpage was detected before the second moment; wherein the time interval between the first moment and the second moment is the first duration, and the callback of the first webpage indicates that the first webpage has been fully loaded.
[0011] In this application embodiment, the first moment can refer to the moment when the webpage loading method mentioned in this application embodiment is invoked, and the webpage loading method can refer to the loadUrl method mentioned in this application embodiment. Furthermore, since the electronic device triggers a timer when the webpage loading method is invoked, the first moment can also refer to the start time of the timer. The callback corresponding to the first webpage can refer to the callback to the onPageFinished method mentioned in this application embodiment, which can be used to indicate that the first webpage has finished loading. The second moment can refer to the moment when the timer expires.
[0012] In this embodiment of the application, the electronic device can determine that the first webpage has entered a webpage lag state based on the timer expiring and the first webpage not being fully loaded.
[0013] In one possible implementation of the first aspect above, the network performance parameters of the electronic device include at least one of network latency, network retransmission rate, and network packet loss rate; the first condition includes at least one of the following conditions: network latency is greater than a latency threshold, network retransmission rate is greater than a retransmission rate threshold, and network packet loss rate is greater than a packet loss rate threshold.
[0014] In other embodiments of this application, the network performance parameters of the electronic device may also include other parameters, such as network bandwidth, network signal strength, network signal-to-noise ratio, etc., which are not limited here. Furthermore, based on different network performance parameters, preset network performance parameter thresholds corresponding to different network performance parameters can be set, and the preset network performance parameter thresholds can be used as a benchmark for measuring the network performance of the electronic device.
[0015] In one possible implementation of the first aspect above, optimizing the network of the electronic device includes: switching the electronic device from the first network to a second network for data service communication based on the electronic device communicating through the first network, wherein the first network and the second network have different network types and / or the operators of the first network and the second network are different.
[0016] It is understood that data service communication can refer to loading the first webpage via a network as mentioned in the embodiments of this application. The first network and the second network are of different network types, which can refer to the first network and the second network being Wi-Fi networks or cellular networks.
[0017] In some embodiments, the electronic device can support optimal network link selection via primary and secondary dual Wi-Fi network links (if there are two Wi-Fi network links) and primary and secondary cellular network links (if there are two cellular cards), and can also support network optimization via a single Wi-Fi network link or a single cellular link. That is, the electronic device can automatically select the best path among multiple available network connections to ensure the stability and efficiency of web page loading and data transmission.
[0018] Furthermore, in some embodiments, the electronic device can also utilize network convergence technology, specifically the integration of multiple network channels, allowing the electronic device to simultaneously utilize the bandwidth of multiple networks to load the first webpage. For example, by using network convergence technology, the electronic device can simultaneously use Wi-Fi and cellular data networks to load the first webpage, thereby accelerating the loading speed of the first webpage by aggregating the bandwidth of the two networks.
[0019] In one possible implementation of the first aspect above, switching the electronic device from the first network to the second network for data service communication includes: switching the electronic device from the first network to the second network for data service communication when the network quality of the second network is higher than that of the first network.
[0020] In this embodiment, the electronic device can determine the network quality of the first network and the second network by measuring their network signal strengths. A higher network signal strength indicates higher network signal quality. It is understood that this application does not limit the specific method by which the electronic device determines the network quality.
[0021] In one possible implementation of the first aspect described above, optimizing the network of the electronic device further includes: improving the network access optimization level of the application based on the fact that the first network is a network loaded by the application.
[0022] In this embodiment of the application, improving the network access optimization level of the application can refer to the electronic device mentioned in this embodiment of the application, which can obtain the data packets that need to be loaded during the loading of the first webpage. The data packets may be data packets of images, text, videos, etc., determine the packet sending priority of different data packets, and send the data packets with higher priority first. The data packets with higher priority can be used as key data in the loading process of the first webpage. In this way, improving the loading speed of key data can optimize the use of network resources of the first network and improve the overall loading efficiency of the first webpage.
[0023] In one possible implementation of the first aspect described above, the first webpage is a webpage stored outside the electronic device.
[0024] It is understood that the webpage stored outside the electronic device can refer to the webpages stored on other electronic devices such as network servers mentioned in the embodiments of this application. Therefore, when loading the first webpage, the electronic device needs to interact with other electronic devices via the network to achieve the loading of the first webpage.
[0025] In one possible implementation of the first aspect above, in response to the network performance parameters of the electronic device satisfying the first condition, network optimization processing of the electronic device is performed, including: if the first webpage is detected to have not finished loading within a first time period, based on the fact that the electronic device is not in a screen-off or screen-locked state, or that the application corresponding to the first webpage has not been switched to the background, in response to the network performance parameters of the electronic device satisfying the first condition, network optimization processing of the electronic device is performed; if the first webpage is detected to have not finished loading within a first time period, based on the fact that the electronic device has not switched multiple applications within a second time period, in response to the network performance parameters of the electronic device satisfying the first condition, network optimization processing of the electronic device is performed.
[0026] In some embodiments of this application, after the electronic device detects that the first webpage is in a lag state, it can also determine that there may be other non-network anomalies that caused the first webpage not to load completely if the first webpage has not been detected to have finished loading within a third time period. In this case, the electronic device can automatically confirm that the first webpage has exited the lag state.
[0027] In some embodiments of this application, after detecting that the first webpage is in a lag state, the electronic device can also automatically confirm that the first webpage has exited the lag state based on the detection that the electronic device enters a screen-off or screen-locked state within a third time period, or that the application corresponding to the first webpage is running in the background.
[0028] It is understood that the third duration can refer to 10 seconds or similar durations mentioned in the embodiments of this application, and is not limited here. In addition, the third duration is longer than the first duration and the second duration.
[0029] In one possible implementation of the first aspect above, the method further includes: detecting that the application corresponding to the first webpage is closed, and restoring the network of the electronic device to the state before the optimization process.
[0030] Secondly, embodiments of this application provide an electronic device, including a memory for storing instructions and a processor for executing the instructions to implement the web page loading method provided in the first aspect and various possible implementations of the first aspect.
[0031] Thirdly, embodiments of this application provide a readable storage medium storing instructions that, when executed on an electronic device, cause the terminal device to perform the web page loading method provided in the first aspect and various possible implementations of the first aspect.
[0032] Fourthly, embodiments of this application also provide a computer program product, including a computer program / instruction that, when executed by a processor, implements the web page loading method provided in the first aspect and various possible implementations of the first aspect.
[0033] The beneficial effects of the second to fourth aspects mentioned above can be referred to the relevant descriptions in the first aspect and various possible implementations of the first aspect, which will not be repeated here. Attached Figure Description
[0034] Figure 1A According to the embodiments provided in this application, a schematic diagram of a mobile phone browser interface is shown;
[0035] Figure 1B According to the embodiments provided in this application, a schematic diagram of a webpage loading interface for a mobile phone is shown;
[0036] Figure 2AAccording to the embodiments provided in this application, a schematic diagram of a news interface for a mobile phone is shown;
[0037] Figure 2B According to the embodiments provided in this application, a schematic diagram of an information loading interface for a mobile phone is shown;
[0038] Figure 3 According to the embodiments provided in this application, a schematic diagram of the architecture of an operating system for an electronic device is shown;
[0039] Figure 4 According to the embodiments provided in this application, a flowchart of a webpage loading method is shown;
[0040] Figure 5 According to the embodiments provided in this application, a flowchart for identifying webpage lag is shown;
[0041] Figure 6 According to the embodiments provided in this application, a schematic flowchart of a network optimization process is shown;
[0042] Figure 7 According to the embodiments provided in this application, a schematic diagram of the structure of an electronic device 100 is shown. Detailed Implementation
[0043] The illustrative embodiments of this application include, but are not limited to, a web page loading method, an electronic device, and a readable storage medium.
[0044] It is understood that the electronic devices in the embodiments of this application may also be referred to as terminals, user terminals, mobile terminals, user equipment (UE), terminal devices, mobile stations (MS), mobile terminals (MT), etc. Terminal devices may include mobile phones, smart TVs, wearable devices, tablets, computers, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, terminals in industrial control, terminals in self-driving, terminals in smart grids, terminals in transportation safety, terminals in smart cities, and smart homes in smart homes, etc.
[0045] It is understood that the technical solutions provided in this application can be applied to various communication systems, such as: 5th generation (5G) mobile communication systems or new radio access technology (NR), long term evolution (LTE) systems, LTE frequency division duplex (FDD) systems, LTE time division duplex (TDD) systems, universal mobile telecommunication systems (UMTS), etc. The technical solutions provided in this application can also be applied to future communication systems, such as 6th generation mobile communication systems.
[0046] It is understood that the applications in the embodiments of this application may include video applications, shopping applications, browsing applications, game applications, etc., and are not limited thereto.
[0047] The technical solution of this application is described below with reference to the accompanying drawings.
[0048] As mentioned earlier, when an application opens a webpage in a poor network environment, problems may occur such as the application failing to load the webpage or the webpage loading being slow. Users may have to wait a long time to see the webpage content, which affects the user experience.
[0049] For example, Figure 1A A schematic diagram of a browser interface 101 of a mobile phone 10 is shown. Figure 1B A schematic diagram of a webpage loading interface 103 on a mobile phone 10 is shown.
[0050] Figure 1A In this context, mobile phone 10 communicates via Wi-Fi. Mobile phone 10 runs a browser that displays a browser interface 101. The user can enter the web address "www.xxxx.com" into the search control 102 on this browser interface 101, causing mobile phone 10 to display... Figure 1B The webpage loading screen shown is 103. (Reference) Figure 1B The webpage loading interface 103 displayed on the mobile phone 10 shows the webpage loading progress (e.g., still loading).
[0051] Continue to refer to Figure 1A and Figure 1B , Figure 1A The time when the webpage started loading was "11:16:36:530 milliseconds". Figure 1BThe webpage loading time is "11:16:38.281 milliseconds", with a time difference of "1 second and 751 milliseconds". This means that after "1 second and 751 milliseconds" since the webpage loading was triggered, the webpage has still not loaded successfully. Therefore, this indicates that the webpage loading is experiencing a lag, which could be caused by a poor Wi-Fi network environment, affecting webpage loading and consequently impacting the user's online experience.
[0052] For example, Figure 2A A schematic diagram of a news interface 201 on a mobile phone 10 is shown. Figure 2A In this context, mobile phone 10 utilizes cellular network communication. When mobile phone 10 runs a news application, it can display a news interface 201. Users can click on the information control 202 within this news interface 201 to display... Figure 2B The information loading interface shown is 203.
[0053] Figure 2B A schematic diagram of an information loading interface 203 on a mobile phone 10 is shown. Figure 2B In the middle, the information loading interface 203 displayed on the mobile phone 10 shows the information loading progress (e.g., it has not yet finished loading).
[0054] Continue to refer to Figure 2A and Figure 2B , Figure 2A The page started loading at 4:19:14:198. Figure 2B The webpage's real-time loading time is "4 hours, 19 minutes, 17 seconds, and 029 milliseconds," with a time difference of "2 seconds and 831 milliseconds." This means that after "2 seconds and 831 milliseconds" since the information loading was triggered, the webpage has still not finished loading. Therefore, this indicates that the webpage is experiencing loading lag, which could be caused by a poor cellular network environment affecting the phone's ability to load webpages and thus impacting the user's online experience.
[0055] To address the aforementioned technical problems, this application provides a webpage loading method. In this method, during the loading of a first webpage from an application, if the electronic device detects that the first webpage has not finished loading within a preset time period (e.g., a first time period), it can detect the network performance parameters of the electronic device. If the electronic device detects that the network performance parameters meet preset conditions (e.g., a first condition, which may indicate poor network performance), it optimizes the network of the electronic device. Then, the electronic device loads the first webpage based on the optimized network.
[0056] In some embodiments of this application, the network performance parameters of the electronic device may include network latency, network retransmission rate, network packet loss rate, etc., which are not limited here. Furthermore, preset conditions may include: network latency greater than a preset latency threshold, network retransmission rate greater than a preset retransmission rate threshold, or network packet loss rate greater than a preset packet loss rate threshold, etc., which are not limited here.
[0057] In some embodiments of this application, the first duration can be 2 seconds or less, and is not limited herein.
[0058] Based on the aforementioned webpage loading method, an electronic device can quickly identify a loading lag in the first webpage if it fails to complete loading within a certain timeframe. Furthermore, the device can detect if the lag is caused by poor network performance. The device then optimizes its network and loads the first webpage using the optimized network, thus improving the loading lag issue and enabling the first webpage to load quickly. In this way, the electronic device can detect webpage lag caused by poor network performance in a short time, optimize the network, and ensure rapid loading of the first webpage, reducing the user's perception of webpage lag and improving the user experience.
[0059] It is understandable that if the network performance parameters of an electronic device meet the aforementioned preset conditions, it indicates that the network performance of the electronic device is poor.
[0060] It is understood that the webpage loading method provided in this application monitors and identifies webpage lag in applications at the electronic device system framework layer, enabling the electronic device to quickly identify webpage lag caused by poor network performance and rapidly perform network optimization. For example, for news applications, using the webpage loading method provided in this application, the electronic device can quickly identify webpage lag in news applications, and after determining that the cause of the webpage lag is poor network performance, it quickly initiates network optimization to rapidly restore the normal loading and display of webpages in the application, thereby improving the user experience.
[0061] To further understand the display method provided in the embodiments of this application, Figure 3 This diagram illustrates the architecture of an operating system for an electronic device. This system architecture can be applied to electronic devices such as mobile phones, tablets, and laptops.
[0062] like Figure 3 As shown in the diagram, the operating system architecture includes an application layer 30 and a framework layer 31. Wherein:
[0063] Application layer 30 can include different applications. Specifically, applications can include video applications such as Douyin and Xiaohongshu; shopping applications such as Meituan and JD.com; game applications; and browsing applications such as Zhihu, Toutiao, and browsers, etc., without limitation. In addition, the application layer can also include system applications, such as video, photo album, and camera applications, without limitation.
[0064] The framework layer 31 may include the WebView module 310 and the protocol module 320.
[0065] The WebView module 310 is responsible for loading and displaying web page content within the application. The WebView module 310 can provide an application programming interface (API) to trigger web page loading (e.g., calling the loadUrl method). The WebView module 310 can also manage the application's web page loading process, including resource downloading, HTML parsing, and page rendering. For example, the WebView module 310 can download and cache resources required for the web page, such as HTML, CSS, JavaScript, and images. The WebView module 310 can also act as a rendering engine, parsing HTML and CSS and performing page rendering, among other things; this is not a limitation here.
[0066] In some embodiments of this application, the WebView module 310 can trigger the loading of a webpage (such as the first webpage) corresponding to a specified URL by calling the loadUrl method. The WebView module 310 can detect the loading status of the first webpage by detecting whether the onPageFinished method has been called. In addition, the WebView module 310 can also notify the protocol module 320 of the detected loading status of the first webpage. It is understood that the loading status of the first webpage may include the first webpage starting to load, the first webpage completing loading, the first webpage loading being slow, etc., and is not limited here.
[0067] Protocol module 320 can be used to detect and optimize network communication of electronic devices. In some embodiments of this application, the protocol module can receive notifications from WebView module 310 indicating the loading status of a webpage. For example, based on receiving a notification indicating that the webpage is experiencing lag, protocol module 320 can trigger the detection of network performance parameters of the electronic device, such as network latency, network retransmission rate, and network packet loss rate. Protocol module 320 can detect the network quality, i.e., network performance, of the electronic device by determining whether the network performance parameters meet a first condition. Furthermore, when protocol module 320 determines that the network quality of the electronic device is poor through network performance parameters, it can trigger network optimization processing for the electronic device.
[0068] In some embodiments of this application, when it is determined that the first webpage is in a webpage lag state, the protocol module 320 can also detect the state of the electronic device or the application corresponding to the first webpage. For example, the protocol module 320 can detect that the electronic device has entered a screen-off or screen-locked state, the application corresponding to the first webpage is running in the background, or the electronic device switches between multiple applications within a second period of time. Based on any of the above situations, the protocol module 320 can automatically determine that the first webpage is no longer in a webpage lag state.
[0069] To further understand the webpage loading method provided in the embodiments of this application, Figure 4 A flowchart illustrating a webpage loading method is shown. This webpage loading method can be applied to electronic devices.
[0070] S401: The first webpage was detected as not loading completely within the first time period.
[0071] In some embodiments of this application, the electronic device may be a mobile phone, tablet computer, laptop computer, etc. The first webpage may be a webpage in a news application on the electronic device, etc.
[0072] In some embodiments of this application, the electronic device can determine that the first webpage has started loading by detecting that a webpage loading method is called at a first moment. This webpage loading method can be a method such as `loadUrl`. The electronic device can determine that the first webpage has not finished loading within a first time period based on the absence of a callback corresponding to the first webpage before a second moment. This callback can refer to a callback to the `onPageFinished` method, which can be used to indicate that the webpage loading is complete. Specifically, the `onPageFinished` method can include the loading progress of the first webpage. When the loading progress of the first webpage is detected to be 100%, it can be determined that the first webpage has finished loading, and the user can then see all the content corresponding to that first webpage.
[0073] Based on this, if the electronic device does not detect the callback of the corresponding onPageFinished method within the first time period, it can be determined that the first webpage has not been fully loaded within the first time period, where the first time period can refer to the time interval between the first moment and the second moment.
[0074] Furthermore, it can be understood that the first webpage can be a webpage stored on other electronic devices, such as a web server. For a first webpage stored on other electronic devices, the WebView module 310 of the electronic device needs to load the first webpage based on the network.
[0075] In this embodiment, a timer can be used to detect whether the first webpage has finished loading within a first duration. The expiration duration of the timer can be set to the first duration. Specifically, when the electronic device calls the loadUrl method based on the WebView module 310 to load the first webpage, the timer can be triggered. The expiration duration of the timer can be set to, for example, 2 seconds. If the WebView module 310 does not detect the callback of the corresponding onPageFinished method after the timer expires, it can be determined that the first webpage has not finished loading within the first duration, and the first webpage is in a lag state.
[0076] It is understandable that when the WebView module 310 of the electronic device determines that the first webpage has entered a lag state based on the timer expiring and the first webpage has not finished loading, the WebView module 310 can notify the protocol module 320 that the first webpage has entered a lag state.
[0077] S402: In response to the network performance parameters of the electronic device meeting the first condition, optimize the network of the electronic device.
[0078] In some embodiments of this application, when the protocol module 320 receives a notification that the first webpage has entered a lag state, the protocol module 320 can trigger the detection of network performance parameters of the electronic device. If the protocol module 320 detects that the network performance parameters meet a first condition, it can determine that the reason for the lag of the first webpage is poor network performance of the electronic device, or poor network quality of the electronic device. Based on this, the protocol module 320 can trigger network optimization processing for the electronic device.
[0079] In this embodiment of the application, the network performance parameters of the electronic device may include network latency, network retransmission rate, network packet loss rate, etc., which are not limited here. Furthermore, the first condition may include: network latency greater than a preset latency threshold, network retransmission rate greater than a preset retransmission rate threshold, or network packet loss rate greater than a preset packet loss rate threshold, etc., which are not limited here.
[0080] It is understood that the above examples of network performance parameters such as network latency, network retransmission rate, and network packet loss rate are merely illustrative. In other embodiments of this application, the network performance parameters of the electronic device may also include other parameters, such as network bandwidth, network signal strength, network signal-to-noise ratio, etc., which are not limited here. Furthermore, based on different network performance parameters, preset network performance parameter thresholds corresponding to different network performance parameters can be set, and the preset network performance parameter thresholds can serve as a benchmark for measuring the network performance of the electronic device.
[0081] In some embodiments of this application, the protocol module 320 of the electronic device can optimize the network of the electronic device if it detects that the first webpage has not finished loading within a first time period, i.e., it determines that the first webpage is in a webpage lag state, and the network performance parameters of the electronic device meet a first condition, based on the fact that the electronic device is not in a screen-off or screen-locked state, or that the application corresponding to the first webpage has not been switched to the background. Furthermore, the protocol module 320 of the electronic device can also optimize the network of the electronic device if the network performance parameters of the electronic device meet the first condition while the first webpage is in a webpage lag state, and based on the fact that the electronic device has not switched between multiple applications within a second time period.
[0082] In some embodiments of this application, network optimization processing may include network switching or network acceleration. For example, assuming an electronic device loads a first webpage via a first network, the protocol module 320 can control the electronic device to switch from the first network to a second network before loading the first webpage, wherein the first network and the second network have different network types and / or operators. As another example, assuming an electronic device loads a first webpage via a first network, the electronic device can switch from the first network to the second network before loading the first webpage, wherein the network quality of the second network may be higher than that of the first network. Yet another example, assuming an electronic device loads a first webpage via a first network, the electronic device can obtain the priority of each data packet when the first webpage is loaded and access the corresponding data packet according to the priority. It is understood that this application does not specifically limit the method of network optimization processing.
[0083] S403: Load the first webpage based on the optimized network.
[0084] In some embodiments of this application, the electronic device can load the first webpage through an optimized network, enabling the first webpage to load quickly.
[0085] It is understandable that if the protocol module 320 of the electronic device detects that the application corresponding to the first webpage is closed, the network of the electronic device can be restored to the state before the optimization process.
[0086] Based on the aforementioned webpage loading method, an electronic device can quickly identify a loading lag in the first webpage if it fails to complete loading within a certain timeframe. Furthermore, the device can detect if the lag is caused by poor network performance. The device then optimizes its network and loads the first webpage using the optimized network, thus improving the loading lag issue and enabling the first webpage to load quickly. In this way, the electronic device can detect webpage lag caused by poor network performance in a short time, optimize the network, and ensure rapid loading of the first webpage, reducing the user's perception of webpage lag and improving the user experience.
[0087] To further understand the webpage loading method provided in the embodiments of this application, the specific implementation process of quickly detecting webpage lag in the webpage loading method is described below.
[0088] As an example, Figure 5 This diagram illustrates a process for identifying webpage lag. It is understandable that... Figure 5 The execution entity for each process can be the WebView module 310 of the electronic device.
[0089] refer to Figure 5 The specific process includes:
[0090] S501: The loadUrl method was detected to be called based on the first URL, and the first webpage was loaded.
[0091] For example, the WebView module 310 of the electronic device can detect that the loadUrl method is called to load the first webpage corresponding to the first URL. In some embodiments of this application, the first URL corresponding to the first webpage can be in the form of "https: / / www.example.com", which is not limited here.
[0092] For example, when an application of an electronic device detects a user action, such as the user clicking on a first Uniform Resource Locator (URL) in the application (URL can also be called a web address), the WebView module 310 can detect that the loadUrl method has been called to load the first web page corresponding to the first URL.
[0093] It is understandable that the loadUrl method is a function provided by the WebView module 310. The web page view (WebView) in the WebView module 310 can call the loadUrl method to load the corresponding web page through the specified URL.
[0094] It is understandable that the first webpage can be based on the Hypertext Transfer Protocol (HTTP) or the Hypertext Transfer Protocol Secure (HTTPS). It is also understandable that the first webpage can be stored on other electronic devices, such as web servers. For a first webpage stored on other electronic devices, the WebView module 310 of the electronic device needs to load the first webpage over the network. For example, the WebView module 310 needs to parse the first URL corresponding to the first webpage, resolving the domain name in the first URL to an Internet Protocol address (IP address); furthermore, the WebView module 310 needs to establish a connection with other electronic devices (such as web servers) via the Transmission Control Protocol (TCP) based on the resolved IP address, sending the webpage loading request for the corresponding first webpage to the other electronic devices and receiving responses from the other electronic devices through the TCP connection.
[0095] In other embodiments, the first webpage can also be a local cache file or a local resource. For loading local cache files or resources, the WebView module 310 can access the local cache file through its corresponding file path without needing a network connection with other electronic devices. For example, the file path of the local cache file can be represented as "file: / / / android_asset / article / ?item_id=0&token=0", where "file: / / :" is a protocol prefix. "android_asset" is an application asset directory that can store static files such as images, text files, and configuration files. "article / :" is a first-level subdirectory under the application asset directory that can be used to store text files of articles from various webpages, images related to the articles, and other resources. "?item_id=0&token=0" refers to a query string, typically used to pass parameter information. "item_id=0" may indicate that the resource related to article number 0 is to be accessed; "token=0" can be a token parameter used for some kind of verification, authorization, or other purpose.
[0096] S502: Determine whether the webpage view corresponding to the first webpage has been processed after the application starts.
[0097] If the judgment result is yes, end this process;
[0098] If the result is negative, proceed to S503 and set the state of the webpage view corresponding to the first webpage to "true" to indicate that the first webpage should start loading.
[0099] In some embodiments of this application, the processing of the webpage view (i.e., WebView) corresponding to the first webpage of the application by the electronic device may refer to the electronic device performing operations such as initialization on the WebView of the first webpage. For example, initialization may refer to the WebView module 310 of the electronic device starting the scripting language Javascript to modify, add, or delete the styles of the page elements corresponding to the first webpage, so as to correctly load and display the first webpage.
[0100] If, after an electronic device opens an application, it detects that the WebView module 310 has performed initialization or other operations on the WebView corresponding to the first webpage, then it can be determined that the electronic device processed the WebView corresponding to the first webpage after the application started. Otherwise, it can be determined that the electronic device did not process the WebView corresponding to the first webpage after the application started, and the initialization process for loading the first webpage can be triggered to ensure that the WebView corresponding to the first webpage can be correctly loaded and displayed.
[0101] It is understood that the webpage loading method in this application is mainly used to monitor the first WebView of an electronic device's application. After an electronic device opens an application, the application may include multiple webpages to be loaded, each with its corresponding WebView. The first WebView of the application is typically used to display the webpage interface seen by the user in the electronic device's display interface. This WebView corresponds to the main interface for user interaction with the electronic device's application. For example, the first WebView may refer to the WebView corresponding to the first webpage, where the first webpage may refer to the webpage visible to the user in the current user interface. It is understood that since the first WebView is the actual display interface seen by the user, its loading status and performance have a significant impact on user experience. Therefore, the webpage loading method provided in this application mainly monitors the first WebView of the electronic device's application.
[0102] S503: Set the state of the webpage view corresponding to the first webpage to "true", indicating that the first webpage should start loading.
[0103] In some embodiments of this application, if the WebView corresponding to the first webpage has not been processed after the application starts, the WebView module 310 of the electronic device can set the state of the WebView corresponding to the first webpage to "true" in the webpage view startup collection (WebView_Boost_Map). Here, "true" can be used to instruct the WebView corresponding to the first webpage to start loading the first webpage.
[0104] It is understandable that WebView_Boost_Map can be a data structure (such as a hash table) used to store and manage the states of different WebView instances. Based on this, when the WebView module 310 triggers the loading of the first webpage, it can synchronously obtain the hash code corresponding to the WebView of the first webpage, so that the WebView module 310 can subsequently determine the loading state of the first webpage in WebView_Boost_Map using the hash code of the WebView corresponding to the first webpage.
[0105] S504: Determine whether the first URL is based on the HTTP or HTTPS protocol.
[0106] If the judgment result is yes, proceed to S505 and start the timer;
[0107] If the result is negative, the process ends.
[0108] In some embodiments of this application, when the WebView module 310 loads the first webpage via the first URL, it can determine whether the first URL is based on the HTTP or HTTPS protocol. If the first URL is based on the HTTP or HTTPS protocol, it can be determined that the first webpage corresponding to the first URL needs to be loaded from the web server. If the first URL is a local address of the electronic device or JavaScript, the electronic device does not need to interact with the network when loading the webpage corresponding to the local address, and the current detection process can be terminated.
[0109] S505: Start timer.
[0110] In some embodiments of this application, when it is determined that the first URL is a URL based on the HTTP or HTTPS protocol, that is, when the first webpage corresponding to the first URL needs to be loaded from the web server, the WebView module 310 can start a timer to monitor the loading time of the first webpage. For example, the expiration time of the timer can be 2 seconds or less, and is not limited here.
[0111] S506: Determine if the timer has expired.
[0112] If the judgment result is yes, proceed to S507 to confirm that the first webpage has entered a webpage lag state;
[0113] If the result is negative, proceed to S508 to determine whether the onPageFinished method has been called.
[0114] S507: Confirm that the first webpage has entered a webpage lag state.
[0115] In some embodiments of this application, if the WebView module 310 detects that a timer has expired, it can determine that the first webpage has entered a webpage lag state. The WebView module 310 can mark the start of webpage lag in the webpage view (WebView) of the first webpage. Furthermore, the WebView module 310 can notify the protocol module 320 that the first webpage has entered a lag state.
[0116] S508: Determine whether the onPageFinished method has been called.
[0117] If the judgment result is yes, proceed to S509 to determine whether the loading progress of the first webpage is 100%;
[0118] If the result is negative, proceed to step S506 above to continue determining whether the timer has expired.
[0119] In some embodiments of this application, if the WebView module 310 detects that the timer has not expired, the WebView module 310 can further determine whether the first webpage has been loaded by detecting whether the onPageFinished method has been called.
[0120] S509: Determine if the loading progress of the first webpage is 100%.
[0121] If the judgment result is yes, proceed to S510 to determine whether the webpage view of the first webpage has been marked as start;
[0122] If the result is negative, proceed to step S506 above to continue determining whether the timer has expired.
[0123] It's understandable that the `onPageFinished` method can be called after the main document of the first webpage has finished loading, but all other resources on the first webpage (such as text, images, videos, and advertisements) may still be loading. Based on this, the loading progress of the first webpage can be further obtained to determine whether the first webpage has been fully loaded.
[0124] It is understandable that the WebView module 310 can monitor the specific loading progress of the first webpage. If it is determined that the loading progress of the first webpage is 100%, it means that the first webpage has been fully loaded, that is, all resources on the first webpage have been loaded.
[0125] S510: Determine whether the webpage view of the first webpage has been marked as start.
[0126] If the judgment result is yes, proceed to S511 to determine whether the timer has expired;
[0127] If the result is negative, the process ends.
[0128] In some embodiments of this application, corresponding to the WebView module 310 detecting that the timer has not expired and the onPageFinished method has been called, the WebView module 310 can further determine whether the WebView of the first webpage has marked the start of webpage loading. It can be understood that the WebView module 310 can use the hash code corresponding to the WebView of the first webpage to query the WebView_Boost_Map to see if the state of the WebView corresponding to the first webpage is "true". If so, it can be determined that the WebView of the first webpage has marked the start of loading.
[0129] In some embodiments of this application, corresponding to the WebView module 310 detecting that the onPageFinished method is called, the WebView module 310 can determine whether the webpage view (WebView) of the first webpage has marked the start of webpage lag, in order to determine whether the first webpage has experienced lag during loading. It can be understood that the WebView module 310 can mark the start of webpage lag in the webpage view (WebView) of the first webpage if loading has not been completed after the timer expires.
[0130] S511: Determine if the timer has expired.
[0131] If the judgment result is yes, proceed to S512 to confirm that the webpage lag on the first webpage has ended;
[0132] If the judgment result is negative, proceed to S513 to cancel the timer.
[0133] In some embodiments of this application, the WebView module 310 can determine whether the timer has expired again if it has been determined that the timer has not expired, the first webpage has been loaded, and the WebView corresponding to the first webpage has been marked as started.
[0134] S512: Confirm the end of the page lag on the first webpage.
[0135] In some embodiments of this application, the WebView module 310 can determine the end of the webpage lag based on the completion of the first webpage loading and the expiration of a timer. Furthermore, the WebView module 310 can send a notification to the protocol module 320 indicating the end of the webpage lag for the first webpage.
[0136] S513: Cancel timer.
[0137] In some embodiments of this application, the WebView module 310 can cancel the timer after the first webpage has finished loading and the timer has not yet expired.
[0138] Based on the above method, an electronic device can determine that the first webpage is in a lag state if it fails to detect the first application's loading completion within a short period of time (e.g., less than or equal to 2 seconds). This allows for rapid identification of a lag state in the first webpage.
[0139] To further understand the webpage loading method provided in the embodiments of this application, the specific implementation process of optimizing the network of electronic devices in the webpage loading method is further introduced below.
[0140] As an example, Figure 6 A schematic diagram of a network optimization process is shown. It can be understood that... Figure 6 The execution entity for each process can be the protocol module 320 of the electronic device.
[0141] refer to Figure 6 The specific process may include:
[0142] S601: Receive a notification indicating the loading status of the first webpage.
[0143] In some embodiments of this application, the protocol module 320 of the electronic device can receive a notification sent by the WebView module 310 indicating the loading status of the first webpage. This notification may include indications that the first webpage has started loading, finished loading, or is experiencing loading lag.
[0144] S602: Determine that the first webpage is experiencing a page freeze.
[0145] In some embodiments of this application, the corresponding protocol module 320 receives a notification indicating that the first webpage is in a webpage lag state, and determines that the first webpage is in a webpage lag state.
[0146] In some other embodiments of this application, after receiving a notification that the first webpage is in a webpage lag state, if the protocol module 320 does not receive a notification from the WebView module 310 indicating that the first webpage lag has ended within a third time period, the protocol module 320 can determine that the first webpage may not have finished loading due to other non-network anomalies, and the protocol module 320 can automatically confirm that the first webpage is not in a webpage lag state.
[0147] In some other embodiments of this application, after receiving a notification that the first webpage is in a webpage lag state, the protocol module 320 detects that the electronic device enters a screen-off or screen-locked state within a third time period, or that the application corresponding to the first webpage is in a background running state. The protocol module 320 can automatically confirm that the first webpage is not in a webpage lag state.
[0148] It is understood that the third duration can be a value such as 10 seconds, and this application does not limit the third duration. In addition, the third duration is longer than the first duration and the second duration mentioned in the embodiment shown in Figure 1 above.
[0149] S603: Triggers the detection of network performance parameters of electronic devices.
[0150] In some embodiments of this application, when the corresponding protocol module 320 determines that the first webpage is in a webpage lag state, the protocol module 320 can trigger the detection of network performance parameters of the electronic device. These network performance parameters may include network latency, network retransmission rate, network packet loss rate, etc., and are not limited thereto.
[0151] In other embodiments of this application, the network performance parameters of the electronic device may also include other parameters, such as network bandwidth, network signal strength, network signal-to-noise ratio, etc., which are not limited here.
[0152] S604: Determine whether the network performance parameters of the electronic device meet the first condition.
[0153] If the judgment result is yes, proceed to S605 to trigger network optimization processing for the electronic device.
[0154] If the result is negative, the process ends.
[0155] In some embodiments of this application, the protocol module 320 can determine whether the network performance parameters of the electronic device meet a first condition. The first condition may include at least one of the following: network latency greater than a latency threshold, network retransmission rate greater than a retransmission rate threshold, network packet loss rate greater than a packet loss rate threshold, etc.
[0156] In other embodiments of this application, the network performance parameters of the electronic device may also include other parameters, such as network bandwidth, network signal strength, network signal-to-noise ratio, etc., which are not limited here. Furthermore, based on different network performance parameters, preset network performance parameter thresholds corresponding to different network performance parameters can be set, and these preset thresholds can serve as a benchmark for measuring the network performance of the electronic device. For example, if the network performance parameter of the electronic device is network signal strength, the first condition may also include the network signal strength being less than a minimum signal strength threshold, etc., which are not limited here.
[0157] S605: Triggers network optimization processing for electronic devices.
[0158] In some embodiments of this application, the protocol module 320 can trigger network optimization processing of the electronic device based on the network performance parameters of the electronic device meeting a first condition.
[0159] It is understood that optimizing the network of electronic devices can include at least one of the following:
[0160] For example, when an electronic device is conducting data service communication (such as loading a first webpage) through a first network, the protocol module 320 switches the electronic device's network from the first network to a second network before continuing data service communication. The first and second networks may be of different network types and / or have different operators. The first and second networks can be cellular networks or Wi-Fi networks.
[0161] It is understood that electronic devices can include primary and secondary dual Wi-Fi network links (if there are two Wi-Fi network links) and primary and secondary cellular network links (if there are two cellular cards), and support network optimization through a single Wi-Fi network link with higher network quality or a single cellular link. In other words, electronic devices can automatically select the optimal path among multiple available network connections to ensure the stability and efficiency of loading the first webpage and data transmission.
[0162] Furthermore, in some embodiments of this application, the electronic device can also utilize network convergence technology. Specifically, network convergence technology refers to integrating multiple network channels, allowing the electronic device to simultaneously utilize the bandwidth of multiple networks to load the first webpage. For example, by using network convergence technology, the electronic device can simultaneously use Wi-Fi and cellular data networks to load the first webpage, thereby accelerating the loading speed of the first webpage by superimposing the bandwidth of the two networks.
[0163] For example, when an electronic device is conducting data service communication (such as loading a webpage) through a first network, the protocol module 320 can switch the electronic device from the first network to the second network for data service communication if the network quality of the second network is higher than that of the first network. Specifically, the protocol module 320 can obtain the network signal strength of both the first and second networks to determine their network quality; a higher signal strength indicates higher network quality. This application does not limit the specific method by which the protocol module 320 determines the network quality.
[0164] For example, when an electronic device communicates via a first network for data services (such as loading a first webpage), the protocol module 320 can obtain the data packets that need to be loaded during the loading process of the first webpage. These data packets can be images, text, videos, etc., and the module can determine the sending priority of different data packets, sending the higher-priority data packets first. These higher-priority data packets can serve as key data in the loading process of the first webpage. In this way, improving the loading speed of key data can optimize the use of network resources on the first network and improve the overall loading efficiency of the first webpage.
[0165] S606: Confirm that the first webpage has finished loading.
[0166] In some embodiments of this application, if the protocol module 320 receives a notification from the WebView module 310 indicating that the webpage lag of the first webpage has ended, it can be determined that the first webpage has finished loading.
[0167] In some other embodiments of this application, after receiving a notification indicating that the webpage lag of the first webpage has ended, if the protocol module 320 detects that it has not received a notification from the WebView module 310 indicating that the webpage lag of the first webpage has started, the protocol module 320 may not perform network optimization processing on the electronic device.
[0168] S607: Determine whether the electronic device is in network optimization mode.
[0169] If the judgment result is yes, proceed to S608 to confirm that this network optimization has taken effect.
[0170] If the result is negative, the process ends.
[0171] In some embodiments of this application, after the protocol module 320 determines that the first webpage has finished loading, it can further determine whether the network of the electronic device is still being optimized.
[0172] S608: Confirm that this network optimization has taken effect.
[0173] In some embodiments of this application, the protocol module 320 can detect whether the network of the electronic device is being optimized, and if so, it can determine that the network optimization of the electronic device is effective.
[0174] Based on the above method, the protocol module 320 of the electronic device can detect the network performance parameters of the electronic device after determining that the first webpage is in a webpage lag state, so as to quickly identify the scenario that the first webpage lag is caused by the poor network performance of the electronic device, optimize the network of the electronic device, so that the electronic device can achieve fast loading of the first webpage based on the optimized and high-performance network, reduce the user's perception that the first webpage is in a webpage lag state, and improve the user experience.
[0175] Furthermore, in the webpage loading method provided in this application embodiment, the electronic device uses the triggering of the loadUrl method as the starting point for calculating network time consumption. It calculates the webpage loading time based on network time consumption, and determines webpage lag when the network loading time does not meet a first condition, triggering the detection of the electronic device's network performance parameters for subsequent network optimization. However, for webpage loading lag caused by non-network performance issues, the electronic device will not trigger the detection of its network performance parameters or network optimization. In this way, the electronic device can more flexibly monitor the loading status of webpages in the application and handle them accordingly.
[0176] Furthermore, the webpage loading method provided in this application allows electronic devices to quickly identify scenarios where webpage loading is slow in applications due to network issues. Through network optimization, it significantly reduces webpage loading time and the user's perception of webpage slowdown, thereby improving the user experience.
[0177] This application also provides an electronic device configured to perform the web page loading method executed by the electronic devices shown in the above embodiments.
[0178] This application also provides a readable storage medium, including a memory for storing instructions and a processor for executing the instructions to cause an electronic device to implement the web page loading method performed by the electronic device provided in the above embodiments.
[0179] This application also provides a computer program product, which includes a computer program. When the computer program is run by an electronic device, the electronic device implements the web page loading method performed by the electronic device provided in the above embodiments.
[0180] Figure 7 A schematic diagram of the structure of an electronic device 100 is shown according to an embodiment of this application.
[0181] In this embodiment of the application, the electronic device 100 may be as described above. Figure 2A In the scenario shown, mobile phone 10 is used. In addition, electronic device 100 can also be a laptop, tablet computer or other electronic device, which is not limited here.
[0182] like Figure 7 As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, a subscriber identification module (SIM) card interface 195, a communication device 196, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a proximity sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, and a bone conduction sensor 180M, etc.
[0183] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.
[0184] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.
[0185] The processor 110 may also include a memory for storing instructions and data.
[0186] USB port 130 is a USB standard compliant interface, specifically a Mini USB port, Micro USB port, USB Type-C port, etc. USB port 130 can be used to connect a charger to charge electronic device 100, and can also be used for data transfer between electronic device 100 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices, such as AR devices.
[0187] The charging management module 140 receives charging input from the charger. While charging the battery 142, the charging management module 140 can also supply power to the electronic device through the power management module 141.
[0188] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, internal memory 121, display 194, camera 193, and wireless communication module 160, etc.
[0189] The wireless communication function of electronic device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor. Antenna 1 and antenna 2 can be used to transmit and receive electromagnetic wave signals, that is, wireless carrier information.
[0190] The mobile communication module 150 can provide solutions for wireless communication applications including 2G / 3G / 4G / 5G / 6G on the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1.
[0191] The wireless communication module 160 can provide solutions for wireless communication applications on the mobile phone 10, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), and ultra-wideband (UWB). The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 can receive electromagnetic waves via antenna 2, filter and amplify the received electromagnetic waves, and transmit them to a modem processor for demodulation. The wireless communication module 160 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 2.
[0192] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0193] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini-LED, a micro-LED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In this embodiment, the display screen 194 can be used to display a display interface corresponding to a first webpage in an application of an electronic device.
[0194] Camera 193 is used to capture still images or videos. An object passes through the lens, generating an optical image that is projected onto a photosensitive element. This photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP (Image Signal Processor) for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP (Digital Signal Processor) for further processing. The DSP converts the digital image signal into standard RGB, YUV, or other image formats.
[0195] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0196] Internal memory 121 can be used to store computer executable program code, including instructions, such as those in the aforementioned memory 103. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc. The data storage area may store data created during the use of electronic device 100, such as control identifiers for security controls, screenshot redraw policy identifiers corresponding to security controls, and patterns, images, and text corresponding to screenshot redraw policies. Furthermore, internal memory 121 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 110 executes various functional applications of electronic device 100 by running instructions stored in internal memory 121 and / or instructions stored in memory located within processor 110.
[0197] Electronic device 100 can implement audio functions through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.
[0198] The accelerometer 180E can detect the magnitude of acceleration of electronic device 100 in various directions (typically three axes). When electronic device 100 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the attitude of electronic device 100.
[0199] Touch sensor 180K, also known as a "touch device," can be located on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a "touchscreen." Touch sensor 180K detects touch operations applied to or near it. The touch sensor can then transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194.
[0200] Motor 191 can generate vibration alerts.
[0201] Indicator 192 can be an indicator light, used to indicate charging status, power changes, or to indicate messages, missed calls, notifications, etc.
[0202] The SIM card interface 195 is used to connect the SIM card.
[0203] It is understood that the structure of the electronic device 100 shown in the embodiments of this application does not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than shown, or combine some components, or split some components, or have different component arrangements. The components shown may be implemented in hardware, software, or a combination of software and hardware.
[0204] The various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.
[0205] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application-specific integrated circuit (ASIC), or a microprocessor.
[0206] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.
[0207] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, CD-ROMs, compact discread-only memory (CD-ROMs), magneto-optical disks, read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other forms of propagated signals. Therefore, machine-readable media includes any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.
[0208] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Furthermore, the inclusion of structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.
[0209] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.
[0210] It should be noted that in the examples and description of this patent, 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 term "comprising" or any other variations thereof is 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 one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0211] Although this application has been illustrated and described with reference to certain preferred embodiments thereof, those skilled in the art should understand that various changes in form and detail may be made thereto without departing from the spirit and scope of this application.
Claims
1. A webpage loading method, characterized in that, Applied to electronic devices, the method includes: The first webpage was detected as not loading completely within the first time period; In response to the network performance parameters of the electronic device meeting the first condition, the network of the electronic device is optimized. The first webpage is loaded based on the optimized network.
2. The method of claim 1, wherein, The detection that the first webpage has not finished loading within the first time period includes: The electronic device was detected to invoke the webpage loading method based on the first address of the first webpage at a first moment. Based on the fact that no callback corresponding to the first webpage was detected before the second time point, it is determined that the first webpage was not fully loaded within the first time period; The time interval between the first moment and the second moment is the first duration, and the callback of the first webpage indicates that the first webpage has finished loading.
3. The method of claim 1, wherein, The network performance parameters of the electronic device include at least one of network latency, network retransmission rate, and network packet loss rate. The first condition includes at least one of the following conditions: the network latency is greater than a latency threshold, the network retransmission rate is greater than a retransmission rate threshold, and the network packet loss rate is greater than a packet loss rate threshold.
4. The method of claim 3, wherein, The network optimization process for the electronic device includes: Based on the electronic device communicating via a first network, the electronic device is switched from communicating via the first network to a second network, wherein the first network and the second network are of different network types and / or the operators of the first network and the second network are different.
5. The method of claim 4, wherein, The step of switching the electronic device from the first network to the second network for data service communication includes: If the network quality of the second network is higher than that of the first network, the electronic device will switch its data service communication from the first network to the second network.
6. The method of claim 5, wherein, The network optimization process for the electronic device further includes: Based on the fact that the first network is a network loaded by the application, the network access optimization level of the application is improved.
7. The method of claim 2, wherein, The first webpage is a webpage stored outside the electronic device.
8. The method of claim 1, wherein, The process of optimizing the network of the electronic device in response to the network performance parameters of the electronic device satisfying a first condition includes: If the first webpage is not fully loaded within a first time period, and the electronic device is not in a screen-off or screen-locked state, or the application corresponding to the first webpage is not switched to the background, and the network performance parameters of the electronic device meet the first condition, the network of the electronic device is optimized. If the first webpage is not fully loaded within the first time period, and the electronic device does not switch between multiple applications within the second time period, and the network performance parameters of the electronic device meet the first condition, the network of the electronic device is optimized.
9. The method of claim 6, wherein, The method further includes: If the application corresponding to the first webpage is detected to be closed, the network of the electronic device is restored to the state before the optimization process.
10. An electronic device, comprising: Includes memory for storing instructions; A processor for executing the instructions to cause the electronic device to implement the web page loading method of any one of claims 1 to 9.
11. A readable storage medium, characterized by, The readable storage medium stores instructions that, when executed on an electronic device, cause the electronic device to perform the web page loading method according to any one of claims 1 to 9.
12. A computer program product, characterised in that, It includes a computer program / instruction that, when executed on an electronic device, causes the electronic device to implement the webpage loading method of any one of claims 1 to 9.