Page loading method, client, electronic equipment and storage medium
The method enhances page loading success and efficiency by switching to locally stored domain names and adapting to device types that can change network segments, addressing latency and resource unavailability issues in current technologies.
Patent Information
- Application Number
- CN202310807624.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-03
- Publication Date
- 2025-01-03
AI Technical Summary
Current page loading methods suffer from low success rates and efficiency due to domain name system latency and regional or network operator issues, leading to increased loading times and resource unavailability.
A page loading method that determines the device type and switches to a locally stored domain name (second domain name) when an abnormality is detected, allowing for immediate resource retrieval without waiting for domain name system effectiveness, and includes backup domain name switching for persistent failures.
Improves loading success rate and efficiency by utilizing locally stored domain names and adapting to device types that can change network segments, reducing failures due to network changes and enhancing user experience.
Smart Images

Figure CN119249014A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of front-end technology, and in particular to a page loading method, a client, an electronic device and a storage medium. Background Art
[0002] Currently, when the front-end page fails to load, the system will switch all resources of the current domain name to the backup domain name. Since the domain name system takes time to take effect, this time will increase the loading time and reduce the loading efficiency. It may also cause users in different regions or different network operators to be unable to load pages based on the backup domain name.
[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0004] The purpose of the embodiments of the present disclosure is to provide a page loading method and apparatus, system and computing device, thereby solving the problems of low page loading success rate and loading efficiency in related technologies to a certain extent.
[0005] According to a first aspect of the present disclosure, a page loading method is provided, the method comprising: in response to obtaining a trigger instruction for page loading, obtaining a device type of a current device, the current device being a device currently performing page loading; in response to the device type being a first type, generating and sending a page loading request based on a first domain name to a server, the first type being a device type having the ability to change a device service network segment; determining a page loading status based on a status of a requested resource corresponding to the page loading request; in response to an abnormality in the page loading status, searching for a second domain name locally on the current device, the second domain name being a domain name of a requested resource corresponding to the page loading request that is successfully loaded locally on the current device; switching the first domain name to the second domain name, and sending a page loading request based on the second domain name to a server, so as to obtain and render the requested resource.
[0006] Optionally, the method also includes: in response to the device type being a second type, searching for a second domain name locally on the current device, and sending a page loading request based on the second domain name to the server, the second type being a device type that does not have the ability to change the device service network segment.
[0007] Optionally, the method further includes: in response to the device type being the second type and the second domain name cannot be found locally on the current device, sending a page loading request based on the first domain name to the server.
[0008] Optionally, the method also includes: in response to any one of the following situations: the device type is the first type, the page loading request based on the first domain name fails, and the second domain name cannot be found locally on the current device; the device type is the first type, and the page loading request based on the second domain name fails; the device type is the second type, and the page loading request based on the second domain name fails; the device type is the second type, the second domain name cannot be found locally on the current device, and the page loading request based on the first domain name fails; then, obtaining a backup domain name from the local domain name list, switching the current domain name to the backup domain name, and sending a page loading request based on the backup domain name to the server to obtain and render the requested resources.
[0009] Optionally, before obtaining the backup domain names from the local domain name list in sequence, the method also includes: determining the number of domain name switching times requested by the current page load; in response to the number of domain name switching times being greater than the request upper limit value, loading the corresponding abnormal page, and the request upper limit value is determined based on the number of backup domain names in the domain name list.
[0010] Optionally, the method further includes: in response to receiving the requested resource, updating the second domain name to a current requested domain name corresponding to the requested resource.
[0011] Optionally, based on the status of the requested resource corresponding to the page loading request, the page loading status is determined, including: determining the page loading status by monitoring the abnormal status of the resource interceptor; or determining the page loading status by capturing the abnormal tag attribute value of the requested resource, and the abnormal tag attribute value is obtained by configuring the abnormal tag attribute for the requested resource.
[0012] According to a second aspect of the present disclosure, a client is provided, and the client includes: an acquisition module, configured to acquire the device type of a current device in response to obtaining a trigger instruction for page loading, the current device being a device that is currently performing page loading; a first sending module, configured to generate and send a page loading request based on a first domain name to a server in response to the device type being the first type, the first type being a device type that has the ability to change the device service network segment; a state determination module, configured to determine a page loading state based on a state of a requested resource corresponding to the page loading request; a search module, configured to search for a second domain name locally on the current device in response to an abnormal page loading state, the second domain name being a domain name of a requested resource that has been successfully loaded locally on the current device corresponding to the page loading request; and a second sending module, configured to switch the first domain name to the second domain name, and send a page loading request based on the second domain name to the server to acquire and render the requested resource.
[0013] According to a third aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method of any of the above embodiments is implemented.
[0014] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: one or more processors; and a storage device for one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to execute the method of any of the above embodiments.
[0015] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program, and when the computer program is run on a computer, the computer executes the method of any one of the above embodiments.
[0016] The exemplary embodiments of the present disclosure may have some or all of the following beneficial effects:
[0017] In the page loading method provided in the example implementation of the present disclosure, on the one hand, by storing the second domain name of the requested resource that has been successfully loaded locally on the current device locally, when the page loading status corresponding to the requested resource is abnormal, the second domain name can be directly searched locally, and the first domain name can be switched to the second domain name, and the page loading request can be resent to obtain the requested resource required to load the page. Since the second domain name is the domain name that has been successfully loaded by the current device and there is no need to wait until the effective time, the loading success rate and loading efficiency after switching the domain name can be improved. On the other hand, by obtaining the device type of the current device, for a first type of device that has the ability to change the device service network, the second domain name can be used to access it when it is determined that the current domain name is unavailable, thereby avoiding the problem of unavailability of available resources due to changes in the service network segment that may result from directly switching the domain name, and reducing the loading failure rate due to changes in the region or network operator.
[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0020] Figure 1 One of the flowcharts of the page loading method according to an embodiment of the present disclosure is schematically shown.
[0021] Figure 2 A schematic diagram of a page loading process when the device type is a first type according to an embodiment of the present disclosure is schematically shown.
[0022] Figure 3 A schematic diagram of a page loading process when the device type is the second type according to an embodiment of the present disclosure is schematically shown.
[0023] Figure 4 A second flowchart of a page loading process according to another embodiment of the present disclosure is schematically shown.
[0024] Figure 5 The structural block diagram of a page loading device according to an embodiment of the present disclosure is schematically shown.
[0025] Figure 6 A block diagram of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0026] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0027] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0028] The system architecture of the page loading method provided in the embodiment of the present application may include a terminal device, a network and a server. The network is used to provide a medium for a communication link between the terminal device and the server. The network may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. A user may use a terminal device to interact with a server through the network to receive or send messages, etc.
[0029] Various communication client applications may be installed on the terminal device, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc., which are not limited in this example. The terminal device may be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, etc.
[0030] The server may be a server that provides various services, such as a backend management server that supports shopping websites browsed by users using terminal devices. The backend management server may analyze and process received page loading requests and page loading requests, and return the processing results (such as the request resources or network resources corresponding to the request, etc.) to the terminal device, so that the terminal device can successfully load the access page according to the returned data.
[0031] It should be noted that the page loading method provided in the embodiment of the present invention is generally executed by a terminal device, and accordingly, the client that implements the page loading method is generally set in the terminal device. It should be understood that the number of terminal devices, networks, and servers is only illustrative. According to the implementation requirements, there can be any number of terminal devices, networks, and servers.
[0032] The following describes the page loading method disclosed in the embodiments of this specification in conjunction with specific embodiments.
[0033] refer to Figure 1 As shown, a page loading method according to an example implementation mode provided by the present disclosure can be applied to a terminal device and may include the following steps.
[0034] Step S110, in response to obtaining a trigger instruction for page loading, obtaining a device type of a current device, wherein the current device is a device currently performing page loading.
[0035] Step S120, in response to the device type being the first type, generating and sending a page loading request based on the first domain name to the server, the first type being a device type having the ability to change the device service network segment.
[0036] Step S130: determining a page loading status based on a status of a requested resource corresponding to the page loading request.
[0037] Step S140, in response to the abnormal page loading state, searching for a second domain name locally on the current device, the second domain name being the domain name of a requested resource corresponding to the page loading request successfully loaded locally on the current device.
[0038] Step S150: switch the first domain name to the second domain name, and send a page loading request based on the second domain name to the server to obtain and render the requested resource.
[0039] In the page loading method provided in this example implementation, on the one hand, the second domain name of the requested resource that has been successfully loaded locally on the current device can be stored locally, so that when the page loading status corresponding to the requested resource is abnormal, the second domain name can be directly searched locally, and the first domain name can be switched to the second domain name, and the page loading request can be resent to obtain the requested resource required to load the page. Since the second domain name is the domain name that has been successfully loaded by the current device and there is no need to wait until the effective time, the loading success rate and loading efficiency after switching the domain name can be improved. On the other hand, by obtaining the device type of the current device, for the first type of device that has the ability to change the device service network, the second domain name can be used to access it when it is determined that the current domain name is unavailable, thereby avoiding the problem of unavailability of available resources due to changes in the service network segment that may be caused by directly switching the domain name, and reducing the loading failure rate due to changes in the region or network operator.
[0040] The following describes each step of the present disclosure in more detail.
[0041] In step S110 , in response to obtaining a trigger instruction for page loading, the device type of the current device is obtained.
[0042] In this example implementation, the trigger instruction for page loading is generated based on receiving an external click or specific gesture operation on a page or application. For example, the trigger instruction for page loading can be an application loading instruction generated by a user clicking on an application, or a page loading trigger instruction generated by a user instructing an application to start through a specific gesture, or a trigger instruction based on a user clicking on a control or hyperlink in an application to enter another page, etc. This example does not limit this.
[0043] In this example implementation, the current device refers to the device that currently needs to load a page, and the device type refers to the device type divided based on the device's ability to change its own service network segment. For example, the device type can be divided according to whether the device has the ability to change its own service network segment, and it can also be divided into different levels of device types according to the size of the device's ability to change its own service network segment. The two can also be combined to divide the device type, which is not limited in this example. For example, the device type can include a second type such as desktop computers and laptops that do not have the ability to change their own service network segments (i.e., devices that cannot load SIM cards) and a first type such as mobile phones and phone watches that have the ability to change their own service network segments (i.e., devices that can load SIM cards). The device type (deviceType) of the current device can be obtained from the user agent of the device.
[0044] In step S120, in response to the device type being the first type, a page loading request based on the first domain name is generated and sent to the server.
[0045] In this example implementation, the first type refers to a device type that has the ability to change the device service network segment, that is, a device that can load and use a SIM (Subscriber Identity Module) card for network communication. The first type of device can actively or passively change the service network segment or operator according to factors such as region, base station or environment. The first type can also include at least one device subtype. For example, the first type can include terminal device types such as mobile phones or phone watches that are loaded with at least one operator's SIM card, and can also include other device types that can be loaded with operator SIM cards. This example does not limit this. Exemplarily, a mobile phone is loaded with at least one operator's SIM card. The mobile phone can connect to the Internet by selecting wireless WiFi or any SIM card, and wireless WiFi and different SIM cards belong to different service network segments respectively. The mobile phone can change the device service network segment by switching between different SIM cards or between wireless WiFi and SIM cards.
[0046] In this example implementation, the first domain name refers to the default configuration domain name of the requested resource to be accessed, and the domain name is used to locate the computer during data transmission. When the device type is determined to be the first type, the default domain name can be used to access the requested resource or resources to determine whether the default domain name can be successfully requested under the current environment (such as the region and service network segment).
[0047] In step S130, the page loading status is determined based on the status of the requested resource corresponding to the page loading request.
[0048] In this example implementation, the page loading state refers to a normal or abnormal state of page loading. The page loading state can be determined by the state of the requested resource. For example, if the requested resource is abnormal, the page loading state is abnormal.
[0049] Exemplarily, the page loading status may be determined by monitoring the abnormal status of the resource interceptor.
[0050] In this example implementation, the global exception event captured by the resource interceptor can be monitored to obtain the exception state information, for example, the exception state of the resource can be captured by using the event listening method with a custom callback function. The page loading state can be determined based on the exception state of the resource, for example, when the resource is in an abnormal state, the page loading state is abnormal.
[0051] Exemplarily, the page loading status may also be determined by capturing the abnormal tag attribute value of the requested resource.
[0052] In this example implementation, an exception tag attribute can be configured for the corresponding request resource. In the event of an exception in the request for the request resource, the request loading status is determined by capturing the exception tag attribute value. For example, when the network resource is loaded abnormally, the corresponding exception tag attribute value is 1, and the attribute value is 0 in the normal state (default state).
[0053] In step S140, in response to the page loading state being abnormal, the second domain name is searched locally on the current device.
[0054] In this example implementation, the second domain name is the domain name of the requested resource corresponding to the page loading request that is successfully loaded locally on the current device, and the requested resource refers to data resources such as text, pictures, audio, and video that are used to generate the page to be loaded from the server. For example, the second domain name is the domain name of the corresponding requested resource that was successfully loaded locally on the current device the last time, and it can be considered the optimal domain name. The second domain name can be cached locally on the current device if the page is successfully loaded. Exemplarily, the second domain name can be cached locally on the current device in the form of a key-value pair, and the corresponding value data (domain name information) is searched in the local cache through the corresponding key data.
[0055] In step S150, the first domain name is switched to the second domain name, and a page loading request based on the second domain name is sent to the server to obtain and render the requested resource.
[0056] In this example implementation, when the first domain name is loaded abnormally and the corresponding second domain name is found locally on the current device, the first domain name can be switched to the second domain name for re-request and page loading. This switching method takes effect quickly, reduces the loading waiting time, and improves the user experience.
[0057] In some embodiments, when the device type is the first type, the page loading request based on the first domain name fails, and the second domain name cannot be found locally on the current device; or the device type is the first type, and the page loading request based on the second domain name fails; then, an alternative domain name is obtained from the local domain name list, the current domain name is switched to the alternative domain name, and a page loading request based on the alternative domain name is sent to the server to obtain and render the requested resources.
[0058] In this example implementation, the local domain name list refers to an available domain name switching list of current resources maintained locally on the current device according to multiple domain names configured for the requested resource (ie, the currently requested network resource), ie, a backup domain name list.
[0059] In this example implementation, when both the first domain name and the second domain name fail to load (i.e., the requested resource is loaded abnormally), the backup domain names can be switched one by one in the order of the local domain name list, and the page loading request is re-issued each time the domain name is switched until the requested resource is received, and then the domain name switching process is stopped.
[0060] In some embodiments, the method further includes: in response to receiving the request resource, updating the second domain name to a current request domain name corresponding to the request resource.
[0061] In this example implementation, when the device successfully requests resources and the current device does not have the second domain name locally, the current request domain name can be cached locally on the current device as the second domain name. When the device successfully requests resources and the current device has the second domain name locally, the current request domain name is used to update the second domain name locally on the current device to ensure the validity of the second domain name.
[0062] For example, Figure 2 As shown, the page loading process for a device type of the first type (eg, deviceType=mobile) may include the following steps.
[0063] Step S210, in response to obtaining a trigger instruction for page loading, generating and sending a page loading request based on the first domain name to the server.
[0064] Step S220, monitor and determine whether the state of the currently requested resource is abnormal. If the state of the requested resource is abnormal, go to step S230, otherwise, go to step S260.
[0065] Step S230, search and determine whether the second domain name exists locally on the current device. If the second domain name is found, go to step S240, otherwise go to step S250.
[0066] Step S240: switch the first domain name to the second domain name, and send a page loading request based on the second domain name to the server to obtain the requested resource, and then go to S260.
[0067] Step S250, obtain an alternate domain name from the local domain name list, switch the current domain name to the alternate domain name, and send a page loading request based on the alternate domain name to the server to obtain the requested resource, and then go to S260.
[0068] Step S260: Render the requested resource to load the requested page.
[0069] In this embodiment, when the user triggers a page loading operation on the current device, a trigger instruction for page loading can be generated. The browser can notify the network process through IPC (Inter-Process Communication) to start requesting and loading the corresponding resources. If it is detected that the request for resources fails, first check the cache (such as cookies or localStorage) to see if the domain name (i.e., the second domain name) that was successfully loaded last time is saved locally on the current device, and then switch the domain name and request again. If the second domain name cannot be found in the cache, the domain name list can be obtained one by one and the domain name can be switched and then reloaded. When the resource request is successful, the current domain name can be written into the cache to update the second domain name. At the same time, the rendering process is notified through IPC to render and load the requested resource.
[0070] In some embodiments, the method further includes: in response to the device type being the second type, searching for a second domain name locally, and sending a page loading request based on the second domain name to the server.
[0071] In this example implementation, the second type refers to a device type that does not have the ability to change the device service network segment, that is, a device that cannot load and use a SIM card. The second type of device generally cannot achieve free switching of service network segments or operators during operation. For the second type of terminal devices (such as deviceType=pc), a fixed service network segment is generally configured. Therefore, this type of terminal is basically fixed in terms of the service network segment or operator used, and there will be no situation where the originally available first domain name resources are unavailable due to the change of the service network segment. Therefore, for the second type of device, the second domain name can be directly searched locally and resource requests can be made based on the second domain name.
[0072] In some embodiments, in response to the device type being the second type and the second domain name not being found locally, a page loading request based on the first domain name is sent to the server.
[0073] In this example implementation, when the second type of device cannot find the second domain name locally, it may make a resource request based on the default domain name (first domain name).
[0074] In some embodiments, the device type is the second type, and the page loading request based on the second domain name fails; or the device type is the second type, the second domain name cannot be found locally, and the page loading request based on the first domain name fails, then an alternative domain name is obtained from the local domain name list, the current domain name is switched to the alternative domain name, and a page loading request based on the alternative domain name is sent to the server to obtain and render the requested resources.
[0075] In this example implementation, when the device type is the second type and the resource request based on the first domain name or the second domain name fails, the backup domain names are sequentially obtained from the local domain name list, and the current domain name is switched to the backup domain name for resource request.
[0076] For example, Figure 3 As shown, the page loading process for the device type being the second type may include the following steps.
[0077] Step S310, in response to obtaining a trigger instruction for page loading, search and determine whether the second domain name exists locally on the current device, if so, go to step S320, otherwise go to step S330.
[0078] Step S320, sending a page loading request based on the second domain name to the server, and then going to step S340.
[0079] Step S330, sending a page loading request based on the first domain name to the server, and then going to step S340.
[0080] Step S340, monitor the abnormal status of the requested resource, if abnormal, go to step S350, otherwise go to receive the requested resource and step S360.
[0081] Step S350, obtain the alternate domain name from the local domain name list, switch the current domain name to the alternate domain name, and send a page loading request based on the alternate domain name to the server, and then go to S340.
[0082] Step S360: Render the requested resource to complete page loading.
[0083] In this embodiment, when the user triggers page loading, the second domain name is first searched from the cache (cookie or localStorage). If found, the domain name is directly switched and a resource request is sent. If not found, the default domain name is used to request the resource. When the resource request fails, the current domain name is switched in sequence according to the order of the local domain name list and the request is made again.
[0084] In some embodiments, before obtaining the backup domain names from the local domain name list in sequence, the method also includes: determining the number of domain name switching times requested by the current page load; in response to the number of domain name switching times being greater than the request upper limit value, loading the corresponding abnormal page, and the request upper limit value is determined based on the number of backup domain names in the domain name list.
[0085] In this example implementation, the number of domain name switches for the current request can be accumulated. After each request failure, it is determined whether the current number of domain name switches reaches the request upper limit. If so, the corresponding abnormal page (such as a network abnormality or loading failure page) can be loaded and wait for the user to reload, otherwise the domain name switch continues. For example, the request upper limit can be set to the number of domain names in the domain name list, that is, each domain name can be tried once; the number of domain names in the list can also be appropriately increased or decreased to determine the request upper limit. Through this example method, when a resource is still unavailable after several switches, it can be determined as a resource abnormality or page loading abnormality, and the initiation of a network request can be terminated to prevent additional network consumption.
[0086] For example, Figure 4 As shown, the page loading method disclosed in the present invention can be implemented through the following steps.
[0087] Step S401: The user triggers page loading on the current device, generates a page loading trigger instruction, and obtains the device type of the current device.
[0088] Step S402: When the device type is the first type, a page loading request based on the first domain name is generated and sent to the server.
[0089] Step S403, monitor whether the status of the requested resource is abnormal. If abnormal, go to step S404, otherwise go to step S410.
[0090] Step S404, determine whether the second domain name is found locally, if found, go to step S405, otherwise, go to step S407.
[0091] Step S405: Send a page loading request based on the second domain name to the server.
[0092] Step S406, monitor whether the status of the requested resource is abnormal, if yes, go to S407, otherwise go to S410.
[0093] Step S407, obtaining an alternate domain name from the local domain name list, switching the current domain name to the alternate domain name, and sending a page loading request based on the alternate domain name to the server.
[0094] Step S408, monitor whether the status of the requested resource is abnormal, if yes, go to step S409, otherwise, go to step S410.
[0095] Step S409, determine whether the number of domain name switching times is equal to the requested upper limit value, if so, go to step S411, otherwise, go to step S407.
[0096] Step S410: receiving and rendering requested resources.
[0097] Step S411, loading the request exception page.
[0098] When the device type is the second type, directly execute S404. If found, execute S405. If the second domain name is not found, go to S402. Then go to S406 to monitor whether the requested resource status is abnormal. If so, go to S407. Otherwise, go to S410. The subsequent steps are similar to those of the first type. Figure 4 The dashed line in the figure indicates that when the state of the page loading request based on the second domain name is abnormal, a page loading request can be sent based on the first domain name, and then the state monitoring can be performed.
[0099] The present invention aims at presenting to the user a corresponding network resource (such as a compiled script file, a cascading style file, a picture file, an audio file or a video file, etc.) after being downloaded in a synchronous or asynchronous manner through a network process when the current user opens an application or accesses a required page. However, in practice, due to the complex network environment, there may be problems such as different lines, different regions, different time periods and different operators that affect the access quality, efficiency and availability of resources.
[0100] On the one hand, the present invention switches the domain name of the current resource by searching the second domain name (optimal domain name) in the local cache of the current device, thereby reducing the probability of resource request failure, thereby also reducing the waiting time of the user caused by retrying the resource failure. On the other hand, the present invention can not only adopt different switching methods for different device types, but also prevent the originally available resources from becoming unavailable after switching due to automatic changes in network signal base stations or regional locations, and avoid the domain name effectiveness time and forced user manual refresh caused by system switching lines. In addition, it can also avoid the information security problem of domain name hijacking caused by manual switching of networks, IP addresses or network types.
[0101] Furthermore, in this exemplary embodiment, a client 500 is also provided. The page loading device 500 can be applied to a terminal device. Figure 5As shown, the client 500 may include: an acquisition module 510, configured to acquire the device type of the current device in response to obtaining a trigger instruction for page loading, wherein the current device is the device currently performing page loading; a first sending module 520, configured to generate and send a page loading request based on a first domain name to a server in response to the device type being the first type, wherein the first type is a device type that has the ability to change the device service network segment; a state determination module 530, configured to determine the page loading state based on the state of the requested resource corresponding to the page loading request; a search module 540, configured to search for a second domain name locally on the current device in response to an abnormal page loading state, wherein the second domain name is a domain name of a requested resource corresponding to the page loading request that is successfully loaded locally on the current device; a second sending module 550, configured to switch the first domain name to the second domain name, and to send a page loading request based on the second domain name to the server to acquire and render the requested resource.
[0102] In an exemplary embodiment of the present disclosure, the second sending module 550 is also configured to: in response to the device type being the second type, search for the second domain name locally on the current device, and send a page loading request based on the second domain name to the server, the second type being a device type that does not have the ability to change the device service network segment.
[0103] In an exemplary embodiment of the present disclosure, the first sending module 520 is further configured to: in response to the device type being the second type and the second domain name cannot be found locally on the current device, send a page loading request based on the first domain name to the server.
[0104] In an exemplary embodiment of the present disclosure, the apparatus 500 further includes a backup switching module, which may be configured to: in response to any of the following conditions: the device type is the first type, a page loading request based on the first domain name fails, and the second domain name cannot be found locally on the current device; the device type is the first type, and a page loading request based on the second domain name fails; the device type is the second type, and a page loading request based on the second domain name fails; the device type is the second type, the second domain name cannot be found locally on the current device, and the page loading request based on the first domain name fails; then obtain a backup domain name from the local domain name list, switch the current domain name to the backup domain name, and send a page loading request based on the backup domain name to the server to obtain and render the requested resource.
[0105] In an exemplary embodiment of the present disclosure, the device 500 also includes: an abnormal page loading module, which can be configured to: determine the number of domain name switching times of the current page loading request; in response to the number of domain name switching times being greater than the request upper limit value, load the corresponding abnormal page, and the request upper limit value is determined based on the number of backup domain names in the domain name list.
[0106] In an exemplary embodiment of the present disclosure, the apparatus 500 further includes: a domain name updating module, which is configured to update the second domain name to a current requested domain name corresponding to the requested resource in response to receiving the requested resource.
[0107] In an exemplary embodiment of the present disclosure, the status determination module 530 can be configured to: determine the page loading status by monitoring the abnormal status of the resource interceptor; or, determine the page loading status by capturing the abnormal tag attribute value of the requested resource, and the abnormal tag attribute value is obtained by configuring the abnormal tag attribute for the requested resource.
[0108] The specific details of each module or unit in the above-mentioned page loading device have been described in detail in the corresponding page loading method, so they will not be repeated here.
[0109] As another aspect, the present application also provides a computer-readable medium, which may be included in the computing device described in the above embodiments; or may exist independently without being assembled into the computing device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a computing device, the computing device implements the method in the following embodiments. For example, the computing device may implement Figure 1 to Figure 4 The various process steps shown, etc.
[0110] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0111] Refer to the following Figure 6 hereinafter describes an electronic device 600 according to such an embodiment of the present disclosure. Figure 6 The electronic device 600 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0112] like Figure 6 As shown, the electronic device 600 is in the form of a general electronic device. The components of the electronic device 600 may include but are not limited to: the at least one processing unit 610, the at least one storage unit 620, a bus 630 connecting different system components (including the storage unit 620 and the processing unit 610), and a display unit 640.
[0113] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 executes the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification.
[0114] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .
[0115] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0116] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0117] The electronic device 600 may also communicate with one or more external devices 660 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 600, and / or communicate with any device that enables the electronic device 600 to communicate with one or more other electronic devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 650. Furthermore, the electronic device 600 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 660. As shown, the network adapter 660 communicates with other modules of the electronic device 600 via a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RA identification systems, tape drives, and data backup storage systems, etc.
[0118] In an exemplary embodiment, a computer program product is also provided, which may include, for example, a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code; when the computer program product runs on a computer, the computer executes the method in the above embodiment.
[0119] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable an electronic device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.
[0120] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0121] It should be noted that, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in the specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc., which shall all be considered as part of the present disclosure.
[0122] It should be understood that the disclosure disclosed and defined in this specification extends to all alternative combinations of two or more individual features mentioned or evident in the text and / or the accompanying drawings. All these different combinations constitute multiple alternative aspects of the disclosure. The embodiments of this specification illustrate the best mode known for implementing the disclosure and will enable those skilled in the art to utilize the disclosure.
Claims
1. A page loading method, characterized in that: include: In response to obtaining a trigger instruction for page loading, obtaining a device type of a current device, where the current device is a device that is currently performing page loading; In response to the device type being a first type, generating and sending a page loading request based on a first domain name to a server, wherein the first type is a device type having a capability of changing a device service network segment; Determining a page loading state based on a state of a requested resource corresponding to the page loading request; In response to the page loading state being abnormal, searching for a second domain name locally on the current device, where the second domain name is a domain name that successfully loads the requested resource locally on the current device; The first domain name is switched to the second domain name, and a page loading request based on the second domain name is sent to the server to obtain and render the requested resource.
2. The page loading method according to claim 1, characterized in that: The method further comprises: In response to the device type being the second type, a second domain name is searched locally on the current device, and a page loading request based on the second domain name is sent to the server. The second type is a device type that does not have the ability to change the device service network segment.
3. The page loading method according to claim 2, characterized in that: The method further comprises: In response to the device type being the second type and the second domain name not being found locally on the current device, a page loading request based on the first domain name is sent to the server.
4. The page loading method according to claim 3, characterized in that: The method further comprises: In response to any of the following conditions: The device type is the first type, the page loading request based on the first domain name fails, and the second domain name cannot be found locally on the current device; The device type is the first type, and the page loading request based on the second domain name fails; The device type is the second type, and the page loading request based on the second domain name fails; The device type is the second type, the second domain name cannot be found locally on the current device, and the page loading request based on the first domain name fails; Then, an alternate domain name is obtained from the local domain name list, the current domain name is switched to the alternate domain name, and a page loading request based on the alternate domain name is sent to the server to obtain and render the requested resource.
5. The page loading method according to claim 4, characterized in that: Before sequentially acquiring the alternate domain names from the local domain name list, the method further includes: Determine the number of domain name switching times for the current page loading request; In response to the number of domain name switching times being greater than a request upper limit, a corresponding abnormal page is loaded, wherein the request upper limit is determined based on the number of backup domain names in the domain name list.
6. The page loading method according to claim 1, characterized in that: The method further comprises: In response to receiving the request resource, the second domain name is updated to a current request domain name corresponding to the request resource.
7. The page loading method according to claim 1, characterized in that: Determining a page loading state based on a state of a requested resource corresponding to the page loading request includes: Determine the page loading status by monitoring the abnormal status of the resource interceptor; or, The page loading state is determined by capturing an abnormal tag attribute value of the request resource, wherein the abnormal tag attribute value is obtained by configuring the abnormal tag attribute for the request resource.
8. A client, characterized in that: include: An acquisition module is configured to acquire a device type of a current device in response to obtaining a trigger instruction for page loading, wherein the current device is a device that is currently performing page loading; A first sending module is configured to generate and send a page loading request based on a first domain name to a server in response to the device type being a first type, wherein the first type is a device type having a capability of changing a device service network segment; A state determination module is configured to determine a page loading state based on a state of a request resource corresponding to the page loading request; A search module is configured to search for a second domain name locally on the current device in response to the abnormal page loading state, where the second domain name is a domain name of a requested resource corresponding to the page loading request successfully loaded locally on the current device; The second sending module is configured to switch the first domain name to the second domain name, and send a page loading request based on the second domain name to the server to obtain and render the requested resource.
9. An electronic device, characterized in that: include: one or more processors; as well as A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
