Page loading method and device, medium and equipment
By analyzing and modifying the resource positioning information of the WebView component, the problem that the WebView component cannot refresh the page is solved, and the same resource positioning information is reloaded, ensuring the normal interaction between the Native application and the H5 page, and improving the user experience.
Patent Information
- Application Number
- CN202510529361.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-08-08
AI Technical Summary
When the WebView component loads the H5 single-page application, it cannot refresh the page content in time, resulting in the Native application being unable to obtain the latest information of the H5 page, interrupting the interaction between native applications and web page content, and reducing the user experience.
By analyzing the resource positioning information of the current page and the page to be loaded, we judge whether it is the same resource positioning information, and determine the processing method based on the comparison results of the total content segment, and modify the resource positioning information to realize the reload of the page, for example, distinguish the resource positioning information by adding a timestamp or identification parameters.
Ensure that the WebView component can reload the page of the same resource location information, avoid the problem of content not refreshing, ensure the normal operation of the business, and improve the user experience.
Smart Images

Figure CN120448660A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of financial technology and page loading technology, and in particular to a page loading method, device, medium and equipment. Background Art
[0002] With the rapid development of mobile internet technology, WebView, a component capable of loading and displaying web content, has been widely used in native applications, such as medical and financial apps. The WebView component is typically used to load HTML5 (H5) single-page applications, achieving a deep integration between native applications and web content.
[0003] Currently, when the WebView component loads an HTML5 single-page application, it displays the content by loading the page's URL (resource location information). During this process, the WebView component follows a defined process to request resources and render the page. It handles various loading events, such as loading start and completion, through related proxy methods (such as the WKNavigationDelegate proxy), thereby maintaining interaction between Native and HTML5.
[0004] However, in actual applications, when the WebView component loads an H5 single-page application, the content may not be updated in time. For example, when using the WebView component to load an H5 single-page application in a medical app or a financial app, when the user or the system needs to refresh the page, it will be achieved by reloading the URL. Due to the WebView's caching mechanism and the unique identification of the URL, when the H5 page tries to refresh the URL, because the URL of the current page is the same as the URL to be loaded, the WebView may not trigger the loading action or the relevant agent will not be executed, that is, the page content of the URL will not be reloaded. This results in the Native application being unable to obtain the latest information of the H5 page in a timely manner, thereby interrupting the interaction between the two and greatly reducing the user experience. Summary of the Invention
[0005] In view of this, the present invention provides a page loading method, apparatus, medium and device, the main purpose of which is to solve the problem that the current page loading method cannot reload the page with the same resource location information.
[0006] According to one aspect of the present application, a page loading method is provided, the method comprising:
[0007] Obtaining first resource location information corresponding to the current page and second resource location information corresponding to the page to be loaded, and parsing the first resource location information and the second resource location information respectively;
[0008] Obtaining first resource location identification information corresponding to the first resource location information and second resource location identification information corresponding to the second resource location information from the parsing result, and determining whether the first resource location information and the second resource location information are the same resource location information based on the first resource location identification information and the second resource location identification information;
[0009] When the first resource location information and the second resource location information are the same resource location information, respectively obtaining a first total content segment corresponding to the first resource location information and a second total content segment corresponding to the second resource location information from the parsing result, comparing the first total content segment with the second total content segment, and determining a processing method for the resource location information based on the comparison result;
[0010] The second resource location information is modified according to the processing method of the resource location information to obtain modified second resource location information, and the page is loaded according to the modified second resource location information.
[0011] Optionally, the first resource location identification information includes a first host name, a first path, and a first server request parameter, and the second resource location identification information includes a second host name, a second path, and a second server request parameter; and determining whether the first resource location information and the second resource location information are the same resource location information based on the first resource location identification information and the second resource location identification information includes:
[0012] Determine whether the first host name and the second host name, the first path and the second path, and the first server request parameters and the second server request parameters are completely identical;
[0013] If the first host name and the second host name, the first path and the second path, and the first server request parameter and the second server request parameter are exactly the same, then the first resource location information and the second resource location information are the same resource location information.
[0014] Optionally, comparing the first total content segment with the second total content segment and determining a processing method for the resource location information according to the comparison result includes:
[0015] If the first total content segment is the same as the second total content segment, the resource location information is processed by adding a timestamp;
[0016] Accordingly, the modifying of the second resource location information according to the processing method of the resource location information includes:
[0017] A timestamp is added to the second server request parameter in the second resource location information to obtain modified second resource location information.
[0018] Optionally, comparing the first total content segment with the second total content segment and determining a processing method for the resource location information according to the comparison result includes:
[0019] If the first total content segment is different from the second total content segment, determining whether the first total content segment and the second total content segment include a preset separator;
[0020] If both the first total content segment and the second total content segment contain the preset delimiter, segmenting the first total content segment according to the preset delimiter to obtain a first sub-content segment and a second sub-content segment, and segmenting the second total content segment to obtain a third sub-content segment and a fourth sub-content segment;
[0021] If the first sub-content segment is the same as the third sub-content segment and the second sub-content segment is different from the fourth sub-content segment, then the resource location information is determined to be processed by adding an identification parameter.
[0022] Optionally, the modifying the second resource location information according to the processing method of the resource location information includes:
[0023] When the resource location information is processed by adding an identification parameter, an identification parameter is added to the second server request parameter of the second resource location information, wherein the identification parameter is different from the parameter included in the second total content segment in the second resource location information.
[0024] Optionally, after determining whether the first total content segment and the second total content segment contain a preset separator, the page loading method further includes:
[0025] If the first total content segment and / or the second total content segment does not include the preset delimiter, the resource location information is processed without processing and the page is loaded according to the second resource location information.
[0026] Optionally, after dividing the first total content segment according to the preset delimiter to obtain a first sub-content segment and a second sub-content segment, and dividing the second total content segment to obtain a third sub-content segment and a fourth sub-content segment, the page loading method further includes:
[0027] If the first sub-content segment is different from the third sub-content segment, the resource location information is processed without any processing, and the page is loaded according to the second resource location information.
[0028] According to another aspect of the present application, a page loading device is provided, comprising:
[0029] a parsing module, configured to obtain first resource location information corresponding to the current page and second resource location information corresponding to the page to be loaded, and parse the first resource location information and the second resource location information respectively;
[0030] a determination module, configured to respectively obtain first resource location identification information corresponding to the first resource location information and second resource location identification information corresponding to the second resource location information from the parsing result, and determine whether the first resource location information and the second resource location information are the same resource location information based on the first resource location identification information and the second resource location identification information;
[0031] a determination module configured to, when the first resource location information and the second resource location information are the same resource location information, respectively obtain from the parsing result a first total content segment corresponding to the first resource location information and a second total content segment corresponding to the second resource location information, compare the first total content segment with the second total content segment, and determine a processing method for the resource location information based on the comparison result;
[0032] The modification module is used to modify the second resource location information according to the processing method of the resource location information to obtain modified second resource location information, and load the page according to the modified second resource location information.
[0033] Optionally, the first resource location identification information includes a first host name, a first path, and a first server request parameter, and the second resource location identification information includes a second host name, a second path, and a second server request parameter; the judgment module is further configured to:
[0034] Determine whether the first host name and the second host name, the first path and the second path, and the first server request parameters and the second server request parameters are completely identical;
[0035] If the first host name and the second host name, the first path and the second path, and the first server request parameter and the second server request parameter are exactly the same, then the first resource location information and the second resource location information are the same resource location information.
[0036] Optionally, the determining module is further configured to:
[0037] If the first total content segment is the same as the second total content segment, the resource location information is processed by adding a timestamp.
[0038] Optionally, the modification module is further configured to:
[0039] When the resource location information is processed in a manner of adding a timestamp, a timestamp is added to the second server request parameter in the second resource location information to obtain modified second resource location information.
[0040] Optionally, the determining module is further configured to:
[0041] If the first total content segment is different from the second total content segment, determining whether the first total content segment and the second total content segment include a preset separator;
[0042] If both the first total content segment and the second total content segment contain the preset delimiter, segmenting the first total content segment according to the preset delimiter to obtain a first sub-content segment and a second sub-content segment, and segmenting the second total content segment to obtain a third sub-content segment and a fourth sub-content segment;
[0043] If the first sub-content segment is the same as the third sub-content segment and the second sub-content segment is different from the fourth sub-content segment, then the resource location information is determined to be processed by adding an identification parameter.
[0044] Optionally, the modification module is further configured to:
[0045] When the resource location information is processed by adding an identification parameter, an identification parameter is added to the second server request parameter of the second resource location information, wherein the identification parameter is different from the parameter included in the second total content segment in the second resource location information.
[0046] Optionally, the determining module is further configured to:
[0047] If the first total content segment and / or the second total content segment does not include the preset delimiter, the resource location information is processed without processing and the page is loaded according to the second resource location information.
[0048] Optionally, the determining module is further configured to:
[0049] If the first sub-content segment is different from the third sub-content segment, the resource location information is processed without any processing, and the page is loaded according to the second resource location information.
[0050] According to another aspect of the present application, a storage medium is provided, in which at least one executable instruction is stored. The executable instruction enables a processor to execute operations corresponding to the above-mentioned page loading method.
[0051] According to another aspect of the present application, a computer device is provided, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus;
[0052] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the above-mentioned page loading method.
[0053] By means of the above technical solution, the technical solution provided by the embodiment of the present invention has at least the following advantages:
[0054] The present application provides a page loading method, apparatus, device and medium, which determine whether the first resource location information corresponding to the current page and the second resource location information corresponding to the page to be loaded are the same resource location information. When it is determined that the first resource location information and the second resource location information are the same resource location information, a processing method for the resource location information is determined based on the first total content segment corresponding to the first resource location information and the second total content segment corresponding to the second resource location information. The second resource location information is modified according to the processing method for the resource location information, and the page is loaded according to the modified second resource location information. By modifying the second resource location information, the page with the same resource location information is reloaded, thereby avoiding the problem of the page content loaded by the WebView component not being refreshed due to the resource location information not being refreshed, ensuring the normal operation of the business and improving the user experience.
[0055] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present invention. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:
[0057] Figure 1 A flow chart of a page loading method provided by an embodiment of the present application is shown;
[0058] Figure 2A flowchart of another page loading method provided by an embodiment of the present application is shown;
[0059] Figure 3 A flow chart of another page loading method provided in an embodiment of the present application is shown;
[0060] Figure 4 A block diagram showing the composition of a page loading device provided in an embodiment of the present application is shown;
[0061] Figure 5 A schematic structural diagram of a computer device provided by an embodiment of the present invention is shown.
[0062] in,
[0063] Figure 4 In: 402-analysis module; 404-judgment module; 406-confirmation module; 408-modification module;
[0064] Figure 5 In the figure: 502 - processor; 504 - communication interface; 506 - memory; 508 - communication bus; 510 - program. DETAILED DESCRIPTION
[0065] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that, in the absence of conflict, the embodiments and features of the embodiments of the present invention can be combined with each other.
[0066] To further illustrate the technical means and effects employed by the present invention to achieve its intended objectives, the following detailed description of the specific implementation methods, structures, features, and effects of the present invention is provided in conjunction with the accompanying drawings and preferred embodiments. In the following description, different references to "one embodiment" or "embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
[0067] In view of the problem that the current page loading method cannot reload the page with the same resource location information, the embodiment of the present application provides a page loading method, such as Figure 1 As shown, the method includes:
[0068] 102: Obtain first resource location information corresponding to the current page and second resource location information corresponding to the page to be loaded, and parse the first resource location information and the second resource location information respectively;
[0069] 104: Obtain first resource location identification information corresponding to the first resource location information and second resource location identification information corresponding to the second resource location information from the parsing result, and determine whether the first resource location information and the second resource location information are the same resource location information based on the first resource location identification information and the second resource location identification information;
[0070] 106: When the first resource location information and the second resource location information are the same resource location information, respectively obtain a first total content segment corresponding to the first resource location information and a second total content segment corresponding to the second resource location information from the parsing result, compare the first total content segment with the second total content segment, and determine a processing method for the resource location information based on the comparison result;
[0071] 108: Modify the second resource location information according to the resource location information processing method to obtain modified second resource location information, and load the page according to the modified second resource location information.
[0072] URL is the abbreviation of Uniform Resource Locator, also known as a web address. It is an identification method used to locate and access resources on the Internet. It is the "address" of resources on the Internet. Through URL, users can accurately find and access various web pages, images, videos, files, and other resources. Therefore, applications load web pages through URLs.
[0073] WebView, as a component that can load and display web page content, has been widely used in Native applications (native applications, such as financial apps). For example, a financial app or a medical app loads an HTML5 (H5) single-page application through the WebView component. The WebView component has a caching function. When loading a web page according to the current URL, it usually caches the URL corresponding to the next web page. When the URL of the current web page is the same as the URL of the next web page, the WebView component does not load a new one. If the user operates on the current page, the web page content should be updated, but because the current URL and the next URL are the same, the WebView component does not load a new one, resulting in the web page being unable to update.
[0074] Based on the above problem, this application proposes to determine whether the URL of the current page (first resource location information) and the URL of the next page (second resource location information) are the same. If they are the same, then determine the processing method of the resource location information, modify the second resource location information of the next page according to the processing method of the resource location information, and load the page according to the modified second resource location information.
[0075] Specifically, the first resource location information corresponding to the current page and the second resource location information corresponding to the page to be loaded are parsed, for example, using NSURL class methods to parse the resource location information, including parsing the string of the resource location information, extracting various parts of the resource location information (such as the protocol, host, path, server request parameters, total content fragment, etc.), and using the host, path, and server request parameters as identification information of the resource location information. From the parsed results, the first resource location identification information corresponding to the first resource location information and the second resource location identification information corresponding to the second resource location information are obtained. When the first resource location identification information and the second resource location identification information are exactly the same, it indicates that the first resource location information and the second resource location information are the same resource location information, and it is necessary to further distinguish the first resource location information from the second resource location information.
[0076] A first total content segment corresponding to the first resource location information and a second total content segment corresponding to the second resource location information are obtained from the parsing results respectively, and the first total content segment and the second total content segment are compared, for example, to determine whether the first total content segment and the second total content segment are exactly the same, and a processing method for the resource location information is determined based on the comparison result, the second resource location information is modified based on the processing method for the resource location information, and a page is loaded based on the modified second resource location information.
[0077] The present application provides a page loading method. Compared with the prior art, it determines whether the first resource location information corresponding to the current page and the second resource location information corresponding to the page to be loaded are the same resource location information. When it is determined that the first resource location information and the second resource location information are the same resource location information, the processing method of the resource location information is determined according to the first total content segment corresponding to the first resource location information and the second total content segment corresponding to the second resource location information. The second resource location information is modified according to the processing method of the resource location information, and the page is loaded according to the modified second resource location information. By modifying the second resource location information, the page with the same resource location information is reloaded, avoiding the problem of the page content loaded by the WebView component not being refreshed due to the resource location information not being refreshed, ensuring the normal operation of the business and improving the user experience.
[0078] In one embodiment, the first resource location identification information includes a first host name, a first path, and a first server request parameter, and the second resource location identification information includes a second host name, a second path, and a second server request parameter. Determining whether the first resource location information and the second resource location information are the same resource location information based on the first resource location identification information and the second resource location identification information includes:
[0079] Determine whether the first host name and the second host name, the first path and the second path, and the first server request parameters and the second server request parameters are exactly the same;
[0080] If the first host name and the second host name, the first path and the second path, and the first server request parameter and the second server request parameter are completely identical, then the first resource location information and the second resource location information are the same resource location information.
[0081] In this embodiment, the protocol used by the resource location information is first identified, such as http, https, ftp, etc. The protocol specifies the rules and methods for data transmission between the client and the server. According to the rules of the protocol, the host name, path, etc. are found after the protocol. The host name, path, and server request parameters are the identification information of the resource location information. By comparing the host name, path, and server request parameters of the first resource location information with the host name, path, and server request parameters of the second resource location information, when the host names of the two are the same, the paths of the two are the same, and the server request parameters of the two are also the same, it means that the first resource location information and the second resource location information are the same resource location information, and the second resource location information needs to be processed. When the host name, path, and server request parameters of the first resource location information are not exactly the same as the host name, path, and server request parameters of the second resource location information, it means that the first resource location information and the second resource location information are not the same resource location information, and the WebView component directly loads the page according to the second resource location information.
[0082] For example, a financial app or a medical app loads page content through WebView. The first resource location information corresponding to the current page and the second resource location information corresponding to the page to be loaded are:
[0083] "https: / / www.example.com / shop?userid=12345# / pulginId / order?orderId=sf1" and "https: / / www.example.com / shop?userid=12345# / pulginId / order?orderId=sf124563", the protocol type is https, the host name is www.example.com, the path is / shop, and the server request parameter is userid=12345#. Therefore, the first resource location information corresponding to the current page and the second resource location information corresponding to the page to be loaded are the same resource location information.
[0084] In another embodiment of the present invention, in order to further define and illustrate, as Figure 2As shown, the page loading method also includes:
[0085] 202: Obtain first resource location information corresponding to the current page and second resource location information corresponding to the page to be loaded, and parse the first resource location information and the second resource location information respectively;
[0086] 204: Obtain first resource location identification information corresponding to the first resource location information and second resource location identification information corresponding to the second resource location information from the parsing result, and determine whether the first resource location information and the second resource location information are the same resource location information based on the first resource location identification information and the second resource location identification information;
[0087] 206: When the first resource location information and the second resource location information are the same resource location information, respectively obtain a first total content segment corresponding to the first resource location information and a second total content segment corresponding to the second resource location information from the parsing result, and compare the first total content segment with the second total content segment;
[0088] 208: If the first total content segment is the same as the second total content segment, the resource location information is processed by adding a timestamp;
[0089] 210: Add a timestamp to the second server request parameter in the second resource location information to obtain modified second resource location information.
[0090] Specifically, the first resource location information and the second resource location information are parsed according to the rules of the protocol. When it is determined based on the parsing result that the first resource location information and the second resource location information are the same resource location information, the first resource location information and the second resource location information need to be further distinguished, and the total content segment is obtained from the parsing result. When the total content segment of the first resource location information is exactly the same as the total content segment of the second resource location information, it means that there is no difference between the first resource location information and the second resource location information, and the second resource location information needs to be processed. A timestamp is added to the second server request parameter of the second resource location information to distinguish the first resource location information. The page is loaded according to the second resource location information with the timestamp added, and the timestamp is added after the last bit of the server request parameter.
[0091] For example, a financial app or a medical app loads page content through WebView. The first resource location information corresponding to the current page and the second resource location information corresponding to the page to be loaded are:
[0092] "https: / / www.example.com / shop?userid=12345# / pulginId / order?orderId=sf1" and "https: / / www.example.com / shop?userid=12345# / pulginId / order?orderId=sf1" have the same host name, path, and server request parameters. Therefore, the first resource location information corresponding to the current page and the second resource location information corresponding to the page to be loaded are the same resource location information. The total content fragment of both is / pulginId / order?orderId=sf1, so a timestamp is added to the second server request parameter in the second resource location information. For example, the added timestamp is "1672531200", and the modified second resource location information is:
[0093] "https: / / www.example.com / shop?userid=12345#1672531200 / pulginId / order?or derId=sf1".
[0094] In another embodiment of the present invention, in order to further define and illustrate, as Figure 3 As shown, the page loading method also includes:
[0095] 302: Obtain first resource location information corresponding to the current page and second resource location information corresponding to the page to be loaded, and parse the first resource location information and the second resource location information respectively;
[0096] 304: Obtain first resource location identification information corresponding to the first resource location information and second resource location identification information corresponding to the second resource location information from the parsing result, and determine whether the first resource location information and the second resource location information are the same resource location information based on the first resource location identification information and the second resource location identification information;
[0097] 306: When the first resource location information and the second resource location information are the same resource location information, respectively obtain a first total content segment corresponding to the first resource location information and a second total content segment corresponding to the second resource location information from the parsing result, and compare the first total content segment with the second total content segment;
[0098] 308: If the first total content segment is different from the second total content segment, determine whether the first total content segment and the second total content segment contain a preset separator;
[0099] 310: If both the first total content segment and the second total content segment contain a preset delimiter, segment the first total content segment according to the preset delimiter to obtain a first sub-content segment and a second sub-content segment, and segment the second total content segment to obtain a third sub-content segment and a fourth sub-content segment;
[0100] 312: If the first sub-content segment and the third sub-content segment are the same and the second sub-content segment and the fourth sub-content segment are different, determine that the resource location information is processed by adding an identification parameter;
[0101] 314: Add an identification parameter to the second server request parameter in the second resource location information, wherein the identification parameter is different from the parameter included in the second total content segment in the second resource location information.
[0102] Specifically, the first resource location information and the second resource location information are parsed according to the rules of the protocol. When it is determined that the first resource location information and the second resource location information are the same resource location information according to the parsing result, the first resource location information and the second resource location information need to be further distinguished, and the total content segment is obtained from the parsing result. When the total content segment of the first resource location information is different from the total content segment of the second resource location information, the difference between the first resource location information and the second resource location information is further judged, and whether the total content segment of the first resource location information and the total content segment of the second resource location information both contain a preset delimiter, for example, the preset delimiter is "?". When the total content segment of the first resource location information and the total content segment of the second resource location information both contain the preset delimiter, the difference between the first resource location information and the second resource location information needs to be further judged, and the preset delimiter is used to determine the difference between the first resource location information and the second resource location information. As the boundary, the total content segments are divided. For the first resource positioning information, the content before the preset delimiter is the first sub-content segment, and the content after the preset delimiter is the second sub-content segment. For the second resource positioning information, the content before the preset delimiter is the third sub-content segment, and the content after the preset delimiter is the fourth sub-content segment. First, determine whether the first sub-content segment is the same as the third sub-content segment. If the first sub-content segment is the same as the third sub-content segment, then determine whether the second sub-content segment is the same as the fourth sub-content segment. When the first sub-content segment is the same as the third sub-content segment and the second sub-content segment is different from the fourth sub-content segment, add an identification parameter to the second server request parameter of the second resource positioning information to distinguish the first resource positioning information. Load the page according to the second resource positioning information with the added identification parameter, and the identification parameter is added after the last bit of the server request parameter.
[0103] For example, a financial app or a medical app loads page content through WebView. The first resource location information corresponding to the current page and the second resource location information corresponding to the page to be loaded are:
[0104] "https: / / www.example.com / shop?userid=12345# / pulginId / order?orderId=sf1" and "https: / / www.example.com / shop?userid=12345# / pulginId / order?orderId=sf123" have the same host name, path, and server request parameters. Therefore, the first resource location information corresponding to the current page and the second resource location information corresponding to the page to be loaded are the same resource location information. The total content fragment of the first resource location information is / pulginId / order?orderId=sf1, and the total content fragment of the second resource location information is / pulginId / order? orderId=sf123. The total content fragments of the two are different, and both contain the preset separator "?". According to the "?", the total content fragments are divided. The first sub-content fragment of the first resource positioning information is / pulginId / order, the second sub-content fragment is orderId=sf1, the third sub-content fragment of the second resource positioning information is / pulginId / order, and the fourth sub-content fragment is orderId=sf123. The first sub-content fragment is the same as the third sub-content fragment and the second sub-content fragment is different from the fourth sub-content fragment. An identification parameter is added to the server request parameter in the second resource positioning information, such as "ab". The added identification parameter is different from the parameter contained in the total content fragment in the second resource positioning information. The modified second resource positioning information is "https: / / www.example.com / shop?userid=12345#ab / pulginId / order?orderId=sf1".
[0105] In this embodiment, if the first total content segment and / or the second total content segment does not include a preset delimiter, the resource location information is processed without processing, and the page is loaded according to the second resource location information.
[0106] Specifically, if the first sub-content segment has a preset delimiter but the second sub-content segment does not have a preset delimiter, the WebView component can distinguish the first resource location information and the second resource location information based on the preset delimiter, and directly load the second resource location information to obtain a new page, thereby avoiding the problem of not being able to load the same resource location information. If the first sub-content segment does not have a preset delimiter but the second sub-content segment does have a preset delimiter, the WebView component can distinguish the first resource location information and the second resource location information based on the preset delimiter, and directly load the second resource location information; if the first sub-content segment does not have a preset delimiter and the second sub-content segment does not have a preset delimiter, since the first total content segment and the second total content segment are different, the WebView component can distinguish the first resource location information and the second resource location information based on the total content segment, and directly load the second resource location information.
[0107] In this embodiment, if the first sub-content segment is different from the third sub-content segment, the resource location information is processed without any processing, and the page is loaded according to the second resource location information.
[0108] Specifically, if the first sub-content fragment is different from the third sub-content fragment, it means that the WebView component can distinguish the first resource location information from the second resource location information, directly load the second resource location information, and obtain a new page, avoiding the problem of not being able to load the same URL.
[0109] Furthermore, as a response to the above Figure 1 The embodiment of the present invention provides a page loading device, such as Figure 4 As shown, the device includes:
[0110] Parsing module 402, used to obtain first resource location information corresponding to the current page and second resource location information corresponding to the page to be loaded, and parse the first resource location information and the second resource location information respectively;
[0111] A determination module 404 is configured to obtain, from the parsing result, first resource location identification information corresponding to the first resource location information and second resource location identification information corresponding to the second resource location information, and determine, based on the first resource location identification information and the second resource location identification information, whether the first resource location information and the second resource location information are the same resource location information;
[0112] Determination module 406 is configured to, when the first resource location information and the second resource location information are the same resource location information, respectively obtain a first total content segment corresponding to the first resource location information and a second total content segment corresponding to the second resource location information from the parsing result, compare the first total content segment with the second total content segment, and determine a processing method for the resource location information based on the comparison result;
[0113] The modification module 408 is configured to modify the second resource location information according to the resource location information processing method to obtain modified second resource location information, and load a page according to the modified second resource location information.
[0114] The present application provides a page loading device. Compared with the prior art, the device determines whether the first resource location information corresponding to the current page and the second resource location information corresponding to the page to be loaded are the same resource location information. When it is determined that the first resource location information and the second resource location information are the same resource location information, the device determines the processing method of the resource location information according to the first total content segment corresponding to the first resource location information and the second total content segment corresponding to the second resource location information. The second resource location information is modified according to the processing method of the resource location information, and the page is loaded according to the modified second resource location information. By modifying the second resource location information, the page with the same resource location information is reloaded, thereby avoiding the problem of the page content loaded by the WebView component not being refreshed due to the resource location information not being refreshed, ensuring the normal operation of the business and improving the user experience.
[0115] In one embodiment, the first resource location identification information includes a first host name, a first path, and a first server request parameter, and the second resource location identification information includes a second host name, a second path, and a second server request parameter; the judgment module is further configured to:
[0116] Determine whether the first host name and the second host name, the first path and the second path, and the first server request parameters and the second server request parameters are exactly the same;
[0117] If the first host name and the second host name, the first path and the second path, and the first server request parameter and the second server request parameter are completely identical, then the first resource location information and the second resource location information are the same resource location information.
[0118] In one embodiment, the determination module is further configured to:
[0119] If the first total content segment is identical to the second total content segment, the resource location information is processed by adding a timestamp.
[0120] In one embodiment, the modification module is further configured to:
[0121] When the resource location information is processed in a manner of adding a timestamp, a timestamp is added to the second server request parameter in the second resource location information to obtain modified second resource location information.
[0122] In one embodiment, the determination module is further configured to:
[0123] If the first total content segment is different from the second total content segment, determining whether the first total content segment and the second total content segment include a preset separator;
[0124] If both the first total content segment and the second total content segment contain a preset delimiter, the first total content segment is segmented according to the preset delimiter to obtain a first sub-content segment and a second sub-content segment, and the second total content segment is segmented to obtain a third sub-content segment and a fourth sub-content segment;
[0125] If the first sub-content segment and the third sub-content segment are the same and the second sub-content segment and the fourth sub-content segment are different, then the processing method for determining the resource location information is to add an identification parameter.
[0126] In one embodiment, the modification module is further configured to:
[0127] When the resource location information is processed by adding an identification parameter, the identification parameter is added to the second server request parameter of the second resource location information, wherein the identification parameter is different from the parameter included in the second total content segment in the second resource location information.
[0128] In one embodiment, the determination module is further configured to:
[0129] If the first total content segment and / or the second total content segment does not include the preset delimiter, the resource location information is processed without processing and the page is loaded according to the second resource location information.
[0130] In one embodiment, the determination module is further configured to:
[0131] If the first sub-content segment is different from the third sub-content segment, the resource location information is processed without any processing, and the page is loaded according to the second resource location information.
[0132] According to one embodiment of the present invention, a storage medium is provided. The storage medium stores at least one executable instruction. The computer-executable instruction can execute the page loading method in any of the above method embodiments.
[0133] Figure 5 A schematic structural diagram of a computer device provided according to an embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the computer device.
[0134] like Figure 5 As shown, the computer device may include: a processor (processor) 502 , a communication interface (Communications Interface) 504 , a memory (memory) 506 , and a communication bus 508 .
[0135] The processor 502 , the communication interface 504 , and the memory 506 communicate with each other via a communication bus 508 .
[0136] The communication interface 504 is used to communicate with other devices such as clients or other servers.
[0137] The processor 502 is configured to execute the program 510 , and specifically to execute the relevant steps in the above-mentioned embodiment of the page loading method.
[0138] Specifically, the program 510 may include program codes, which include computer operation instructions.
[0139] Processor 502 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention. The one or more processors included in a computer device may be of the same type, such as one or more CPUs, or may be of different types, such as one or more CPUs and one or more ASICs.
[0140] The memory 506 is used to store the program 510. The memory 506 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0141] The program 510 may be specifically configured to enable the processor 502 to perform the following operations:
[0142] Obtaining first resource location information corresponding to the current page and second resource location information corresponding to the page to be loaded, and parsing the first resource location information and the second resource location information respectively;
[0143] Obtaining first resource location identification information corresponding to the first resource location information and second resource location identification information corresponding to the second resource location information from the parsing result, and determining whether the first resource location information and the second resource location information are the same resource location information based on the first resource location identification information and the second resource location identification information;
[0144] When the first resource location information and the second resource location information are the same resource location information, respectively obtaining a first total content segment corresponding to the first resource location information and a second total content segment corresponding to the second resource location information from the parsing result, comparing the first total content segment and the second total content segment, and determining a processing method for the resource location information based on the comparison result;
[0145] The second resource location information is modified according to a processing method of the resource location information to obtain modified second resource location information, and the page is loaded according to the modified second resource location information.
[0146] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device, and can be centralized on a single computing device or distributed across a network of multiple computing devices. In one embodiment, they can be implemented using program code executable by a computing device, and thus, can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described herein can be performed in a different order than that shown, or can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0147] The above embodiments are merely exemplary embodiments of the present application and are not intended to limit the scope of the present application. The scope of protection of the present application is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present application within the essence and scope of protection of the present application, and such modifications or equivalent substitutions shall also be deemed to fall within the scope of protection of the present application.
Claims
1. A page loading method, characterized in that: include: Obtaining first resource location information corresponding to the current page and second resource location information corresponding to the page to be loaded, and parsing the first resource location information and the second resource location information respectively; Obtaining first resource location identification information corresponding to the first resource location information and second resource location identification information corresponding to the second resource location information from the parsing result, and determining whether the first resource location information and the second resource location information are the same resource location information based on the first resource location identification information and the second resource location identification information; When the first resource location information and the second resource location information are the same resource location information, respectively obtaining a first total content segment corresponding to the first resource location information and a second total content segment corresponding to the second resource location information from the parsing result, comparing the first total content segment with the second total content segment, and determining a processing method for the resource location information based on the comparison result; The second resource location information is modified according to the processing method of the resource location information to obtain modified second resource location information, and the page is loaded according to the modified second resource location information.
2. The page loading method according to claim 1, wherein: The first resource location identification information includes a first host name, a first path, and a first server request parameter, and the second resource location identification information includes a second host name, a second path, and a second server request parameter; and determining whether the first resource location information and the second resource location information are the same resource location information based on the first resource location identification information and the second resource location identification information includes: Determine whether the first host name and the second host name, the first path and the second path, and the first server request parameters and the second server request parameters are completely identical; If the first host name and the second host name, the first path and the second path, and the first server request parameter and the second server request parameter are exactly the same, then the first resource location information and the second resource location information are the same resource location information.
3. The page loading method according to claim 2, wherein: The comparing the first total content segment and the second total content segment and determining a processing method for the resource location information according to the comparison result includes: If the first total content segment is the same as the second total content segment, the resource location information is processed by adding a timestamp; Accordingly, the modifying of the second resource location information according to the processing method of the resource location information includes: A timestamp is added to the second server request parameter in the second resource location information to obtain modified second resource location information.
4. The page loading method according to claim 2, wherein: The comparing the first total content segment and the second total content segment and determining a processing method for the resource location information according to the comparison result includes: If the first total content segment is different from the second total content segment, determining whether the first total content segment and the second total content segment include a preset separator; If both the first total content segment and the second total content segment contain the preset delimiter, segmenting the first total content segment according to the preset delimiter to obtain a first sub-content segment and a second sub-content segment, and segmenting the second total content segment to obtain a third sub-content segment and a fourth sub-content segment; If the first sub-content segment is the same as the third sub-content segment and the second sub-content segment is different from the fourth sub-content segment, then the resource location information is determined to be processed by adding an identification parameter.
5. The page loading method according to claim 4, wherein: The modifying the second resource location information according to the processing method of the resource location information includes: When the resource location information is processed by adding an identification parameter, an identification parameter is added to the second server request parameter of the second resource location information, wherein the identification parameter is different from the parameter included in the second total content segment in the second resource location information.
6. The page loading method according to claim 4, wherein: After determining whether the first total content segment and the second total content segment contain a preset separator, the page loading method further includes: If the first total content segment and / or the second total content segment does not include the preset delimiter, the resource location information is processed without processing and the page is loaded according to the second resource location information.
7. The page loading method according to claim 4, wherein: After dividing the first total content segment according to the preset delimiter to obtain a first sub-content segment and a second sub-content segment, and dividing the second total content segment to obtain a third sub-content segment and a fourth sub-content segment, the page loading method further includes: If the first sub-content segment is different from the third sub-content segment, the resource location information is processed without any processing, and the page is loaded according to the second resource location information.
8. A page loading device, characterized in that: include: a parsing module, configured to obtain first resource location information corresponding to the current page and second resource location information corresponding to the page to be loaded, and parse the first resource location information and the second resource location information respectively; a determination module, configured to respectively obtain first resource location identification information corresponding to the first resource location information and second resource location identification information corresponding to the second resource location information from the parsing result, and determine whether the first resource location information and the second resource location information are the same resource location information based on the first resource location identification information and the second resource location identification information; a determination module configured to, when the first resource location information and the second resource location information are the same resource location information, respectively obtain from the parsing result a first total content segment corresponding to the first resource location information and a second total content segment corresponding to the second resource location information, compare the first total content segment with the second total content segment, and determine a processing method for the resource location information based on the comparison result; The modification module is used to modify the second resource location information according to the processing method of the resource location information to obtain modified second resource location information, and load the page according to the modified second resource location information.
9. A storage medium storing at least one executable instruction, characterized in that: The executable instructions enable the processor to execute operations corresponding to the page loading method according to any one of claims 1 to 7.
10. A computer device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; characterized in that the memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the page loading method according to any one of claims 1-7.