Network Request Control Method, Device, Medium, and Electronic Device

By turning on or off interception of network requests based on the preset type of switch control parameters when the target page is turned on, the unknown error problem caused by intercepting all page network requests in hybrid development mode is solved, and more accurate and secure network request interception control is achieved.

CN115242862BActive Publication Date: 2025-06-24YANCHENG TIANYANCHAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210900155.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-28
Publication Date
2025-06-24
Estimated Expiration
2042-07-28

AI Technical Summary

Technical Problem

In hybrid development mode, an unknown error may occur when intercepting network requests for all pages in the application to speed up page display.

Method used

By obtaining the network request of the target page and controlling the switches of the preset type, the interception of the network request of the target page is turned on or off.

Benefits of technology

It realizes interception control of page-level network requests, avoids interception of some pages that do not require network interception, reduces the risk of network requests, and improves the accuracy of interception control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115242862B_ABST
    Figure CN115242862B_ABST
Patent Text Reader

Abstract

The present invention relates to a network request control method, device, medium and electronic device. The method includes: obtaining a network request of a target page, where the target page is any page in an application; when the target page belongs to a preset type, determining a switch control parameter for the network request of the target page, where the switch control parameter includes on or off, and the on or the off respectively represents that it is necessary to turn on or off the interception of the network request of the target page; in response to the target page being opened, according to the switch control parameter, turning on or off the interception of the network request of the target page. The present invention can achieve the interception control of page-level network requests.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular, to a network request control method, apparatus, medium, and electronic device. Background Art

[0002] With the ecological development of application programs, more and more application programs require high configurability and high dynamicity. Therefore, a hybrid development mode is usually adopted for the requirement development of application programs. In the hybrid development mode, an "offline solution" is used to accelerate the display of pages. During the process of accelerating the page display, it is necessary to intercept all network requests in the application program to replace the corresponding resources. However, intercepting all network requests within pages may cause some unknown errors in the application program. Summary of the Invention

[0003] This Summary of the Invention section is provided to introduce concepts in a brief form, which will be described in detail in the following Detailed Description section. This Summary of the Invention section is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to be used to limit the scope of the claimed technical solution.

[0004] In a first aspect, the present invention provides a network request control method, and the method includes:

[0005] Obtain a network request of a target page, where the target page is any page in an application program;

[0006] When the target page belongs to a preset type, determine a switch control parameter for the network request of the target page, where the switch control parameter includes on or off, and on or off respectively represents that it is necessary to turn on or off the interception of the network request of the target page;

[0007] In response to the target page being turned on, according to the switch control parameter, turn on or off the interception of the network request of the target page.

[0008] Optionally, the turning on or off the interception of the network request of the target page according to the switch control parameter includes:

[0009] According to the switch control parameter and the network interception state of the target page, turn on or off the interception of the network request of the target page, where the network interception state includes intercepted or not intercepted, and intercepted or not intercepted respectively represents that the network request of the target page has been intercepted or not intercepted.

[0010] Optionally, the method further includes:

[0011] In response to intercepting or canceling the interception of the network request for the previous page or the next page of the target page in the application program, the network interception status of the target page is determined to be intercepted or not intercepted, respectively.

[0012] Optionally, the intercepting or canceling the interception of the network request for the target page according to the switch control parameter includes:

[0013] When the switch control parameter is on and the network interception status is not intercepted, intercept the network request for the target page, and at a preset stage in the life cycle of the target page, determine the network interception status of the target page to be intercepted;

[0014] When the switch control parameter is off and the network interception status is intercepted, cancel the interception of the network request for the target page, and at the preset stage in the life cycle of the target page, determine the network interception status of the target page to be not intercepted.

[0015] Optionally, the intercepting or canceling the interception of the network request for the target page includes:

[0016] Call the interception method or the cancellation interception method in a preset class provided by the operating system to intercept or cancel the interception of the network request for the target page. The interception method is used to intercept the network requests for all pages in the application program, and the cancellation interception method is used to cancel the interception of the network requests for all pages.

[0017] Optionally, the calling the interception method or the cancellation interception method in a preset class provided by the operating system includes:

[0018] Sort and splice multiple first characters and multiple second characters obtained respectively to obtain a first string and a second string, and call the interception method in the preset class through the first string and the second string; or

[0019] Sort and splice multiple first characters and multiple third characters obtained respectively to obtain a first string and a third string, and call the cancellation interception method in the preset class of the operating system through the first string and the third string;

[0020] Wherein, the first string is the string of the preset class, the second string is the string of the interception method, and the third string is the string of the cancellation interception method.

[0021] Optionally, after obtaining the network request of the target page, the method further includes:

[0022] Search for the network request of the target page in a preset network request set, where the preset network request set includes multiple network requests belonging to the preset type;

[0023] When the network request of the target page is found in the preset network request set, determine that the network request of the target web page belongs to the preset type.

[0024] In a second aspect, the present invention provides a network request control device, which includes:

[0025] An acquisition module, configured to acquire a network request of a target page, where the target page is any page in an application;

[0026] A first determination module, configured to determine a switch control parameter of the network request of the target page when the target page belongs to a preset type, where the switch control parameter includes on or off, and the on or the off respectively represents that it is necessary to turn on or off the interception of the network request of the target page;

[0027] A control module, configured to, in response to the target page being turned on, turn on or off the interception of the network request of the target page according to the switch control parameter.

[0028] In a third aspect, the present invention provides a computer-readable medium, on which a computer program is stored, and when the program is executed by a processing device, the steps of the network request control method described in the first aspect are implemented.

[0029] In a fourth aspect, the present invention provides an electronic device, which includes:

[0030] A storage device, on which a computer program is stored;

[0031] A processing device, configured to execute the computer program in the storage device to implement the steps of the network request control method described in the first aspect.

[0032] Through the above technical solutions, by turning on the target page, according to the switch control parameter, turning on or off the interception of the network request of the target page, it is possible to implement the interception control of the page-level network request, and avoid the problem of network request risks caused by intercepting the network of some pages that do not require network interception. Moreover, through the interception control of the page-level network request, it is possible to more accurately intercept the network requests of the pages that need to be intercepted.

[0033] Other features and advantages of the present invention will be described in detail in the subsequent specific implementation part. Description of the Drawings

[0034] In conjunction with the accompanying drawings and with reference to the following specific embodiments, the above and other features, advantages and aspects of the embodiments of the present invention will become more apparent. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic and that the original and elements are not necessarily drawn to scale. In the drawings:

[0035] Figure 1 is a flowchart of a network request control method shown according to an exemplary embodiment;

[0036] Figure 2 is a block diagram of a network request control device shown according to an exemplary embodiment;

[0037] Figure 3 is a schematic structural diagram of an electronic device shown according to an exemplary embodiment. Specific Embodiments

[0038] Embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. On the contrary, these embodiments are provided to more thoroughly and completely understand the present invention. It should be understood that the drawings and embodiments of the present invention are for illustrative purposes only and are not used to limit the scope of protection of the present invention.

[0039] It should be understood that the various steps recited in the method embodiments of the present invention can be executed in a different order and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this regard.

[0040] As used herein, the term "including" and its variants are open-ended, i.e., "including but not limited to". The term "based on" is "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0041] It should be noted that the concepts such as "first" and "second" mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0042] It should be noted that the modifications of "one" and "multiple" mentioned in the present invention are illustrative rather than restrictive. Those skilled in the art should understand that, unless otherwise clearly stated in the context, it should be understood as "one or more".

[0043] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are for illustrative purposes only and are not used to limit the scope of these messages or information.

[0044] As described in the background art, with the ecological development of application programs, more and more application programs require high configurability and high dynamicity. Therefore, a hybrid development mode is usually adopted for the requirement development of application programs. In the hybrid development mode, an "offline solution" is adopted to accelerate the display of pages. During the process of accelerating the page display, it is necessary to intercept the network requests of all pages in the application program to replace the corresponding resources. However, intercepting the network requests of all pages in the application program may cause some unknown errors in the application program.

[0045] Exemplarily, the composition of the entire application program includes not only business Web pages, but also native pages, RN pages, and third-party Web pages, etc. Intercepting the network requests of all pages in the application program means intercepting the network requests in all the aforementioned pages. In this way, some unknown errors may occur after the network requests of some non-own business Web pages are intercepted.

[0046] Figure 1 It is a flowchart of a network request control method shown according to an exemplary embodiment. The network request control method can be applied to an electronic device. As Figure 1 shown, the method includes the following steps:

[0047] Step 110, obtain the network request of the target page, where the target page is any page in the application program;

[0048] In some embodiments, the application program may include at least one of the following pages: native pages, Web pages (i.e., World Wide Web pages), and React Native pages (hereinafter referred to as RN pages).

[0049] In some embodiments, the native page may be an application program page developed based on the local operating system of the terminal (i.e., the native system). For example, an application program page developed based on the local operating system of a mobile phone such as IOS or Android (Android) using the provided development language, development class library, and development tools.

[0050] In some embodiments, the Web page is a web page written based on HyperText Markup Language (HTML), Java language, and / or other programming languages. Usually, the Web page is displayed through a browser, that is, the source code of the Web page is converted into a Web page through the kernel of the browser.

[0051] In some embodiments, the RN page can be a page written using React Native technology. React Native technology is a cross-platform development technology that constructs a JavaScript library for web-based interactive interfaces.

[0052] In some embodiments, the target page can be a to-be-started page that initiates a network request, and this page can be any one of a native page, a web page, and an RN page. For the specific details of native pages, web pages, and RN pages, reference can be made to the relevant descriptions above, and details will not be elaborated here. In some embodiments, the network request of the target page can be automatically initiated by the application.

[0053] Step 120, when the target page belongs to a preset type, determine the switch control parameter for the network request of the target page. The switch control parameter includes on or off, and on or off respectively represents that it is necessary to turn on or off the interception of the network request for the target page.

[0054] In some embodiments, the preset type can be a page type that requires network interception, and the preset type can be flexibly determined according to actual needs. In some embodiments, the preset type can be a web page. In some embodiments, it can be determined whether the target page belongs to the preset type based on the network request of the target page. For example, when the network request of the target page includes a URL (Uniform Resource Locator) address, it can be determined that the target page belongs to the preset type; when the network request of the target page does not include a URL address, it can be determined that the target page does not belong to the preset type. By only turning on or off the interception of the network request for the target page belonging to the preset type in the present invention, that is, only performing network interception control on the target page belonging to the preset type, it avoids resource waste caused by performing network interception control on all types of pages, thereby improving the interception control efficiency of the network request of the target page.

[0055] In some embodiments, it can also be determined whether the network request of the target page belongs to the preset type according to a preset network request set. Correspondingly, in some embodiments, after obtaining the network request of the target page, the method further includes: searching for the network request of the target page in the preset network request set, and the preset network request set includes multiple network requests belonging to the preset type; when the network request of the target page is found in the preset network request set, it is determined that the network request of the target web page belongs to the preset type.

[0056] In some embodiments, the preset network request set may include multiple network requests belonging to a Web page. In some embodiments, the network requests of a Web page may include the URL address of the Web page, that is, the website address. Correspondingly, the multiple network requests in the preset network request set may refer to multiple URL addresses. By way of example, the preset network request set may include network request 1 “http: / / www.AAA.com / xxx1”, network request 2 “http: / / www.AAA.com / xxx2”, and network request 3 “http: / / www.AAA.com / xxx3”, etc.

[0057] In some embodiments, the URL addresses in the preset network request set can be flexibly set according to actual needs. For example, the URL addresses in the preset network request set can be determined according to service requirements, that is, the preset network request set includes Web pages at the service level. By intercepting and controlling only the network requests of the Web pages at the service level, it is possible to avoid errors occurring inside the third-party Web pages caused by intercepting the third-party Web pages included in the Web page. And the network requests of the pages to be intercepted can be customized through the preset network requests, and the interception control of the page-level network requests can be flexibly configured and implemented.

[0058] In some embodiments, the preset network request set can be obtained from a configuration file acquired by the terminal, and the configuration file can be automatically acquired by the terminal when it boots up. Obtaining the preset network request set from the configuration file can enable the terminal to automatically load the preset network request set and improve the acquisition efficiency of the preset network request set.

[0059] In some embodiments, the switch control parameter in the network request can be characterized by an identifier. For example, the switch control parameter can include “networkPolicy=Yes” and “networkPolicy=No”, where “networkPolicy=Yes” indicates that the switch control parameter is on, and “networkPolicy=No” indicates that the switch control parameter is off.

[0060] As mentioned above, the network request may include a URL address. In some embodiments, the switch control parameter can be appended to the end of the URL address in the network request. By way of example, taking the network request of the target page as “http: / / www.AAA.com / xxx1?networkPolicy=Yes” as an example, it can be known from the network request of the target page that the switch control parameter of the target page is on, and at this time, the interception of the network request of the target page needs to be enabled.

[0061] Step 130, in response to the target page being opened, intercept the network request for the target page according to the switch control parameter.

[0062] In the embodiment of the present invention, when the target page is opened, the interception of the network request for the target page is enabled or disabled according to the switch control parameter, so as to realize the interception control of the page-level network request, and avoid the problem of network request risk caused by intercepting the network of some pages that do not require network interception. And because the interception of the network request for the target page is performed when the target page is opened, from the user's perspective, the user can only perceive the interception control of the network request for the target page, and cannot perceive the interception control of the network requests of other pages. Therefore, even if the global interception method is used to intercept the network of the target page, the user is unaware, realizing the page-level interception control of the network request in terms of user perception.

[0063] In some embodiments, enabling or disabling the interception of the network request for the target page may include: calling the interception method or the cancellation interception method in the preset class provided by the operating system to enable or disable the interception of the network request for the target page. The interception method is used to enable the interception of the network requests for all pages in the application, and the cancellation interception method is used to disable the interception of the network requests for all pages.

[0064] In some embodiments, the operating system may refer to the IOS system, the preset class may be the WK BrowsingContext Controller class, the interception method may be the register Scheme For Custom Protocol method in the WK Browsing Context Controller class, and the cancellation interception method may be the unregister Scheme For Custom Protocol method in the WK BrowsingContext Controller class. For the specific details of the WK BrowsingContext Controller class, the register Scheme For Custom Protocol method, and the unregisterScheme For Custom Protocol method, reference may be made to the related art and will not be elaborated here.

[0065] By calling the interception method or the cancellation interception method in the preset class provided by the operating system to perform network interception on the page, directly calling the existing interception method or the cancellation interception method in the operating system, without the need for developers to rewrite the interception method or the cancellation interception method, can improve the interception control efficiency of the page.

[0066] In some embodiments, invoking an interception method or a cancellation interception method in a preset class provided by an operating system includes: sorting and concatenating a plurality of first characters and a plurality of second characters obtained respectively to obtain a first string and a second string, and invoking the interception method in the preset class through the first string and the second string; or sorting and concatenating a plurality of first characters and a plurality of third characters obtained respectively to obtain a first string and a third string, and invoking the cancellation interception method in the preset class of the operating system through the first string and the third string; wherein, the first string is the string of the preset class, the second string is the string of the interception method, and the third string is the string of the cancellation interception method.

[0067] In some embodiments, the first character may be a character included in the string of the preset class. By way of example, the first character may include "W", "K", "Browsing", "Context", and "Controller". The second character may be a character included in the string of the interception method. By way of example, the second character may include "register", "Scheme", "For", "Custom", and "Protocol". The third character may be a character included in the string of the cancellation interception method. By way of example, the third character may include "unregister", "Scheme", "For", "Custom", and "Protocol". It should be noted that this is only a schematic example. In an actual scenario, the order of the plurality of first characters, the plurality of second characters, or the plurality of third characters obtained may be random and not arranged in sequence as shown in the example.

[0068] In some embodiments, the plurality of first characters obtained may be sorted according to the order of the first characters in the string of the preset class. By way of example, when the above first characters "W", "K", "Browsing", "Context", and "Controller" are obtained, they will be sorted and concatenated according to the order of the first characters in the preset class string "W K Browsing Context Controller" to obtain the first string "W K Browsing Context Controller". It can be understood that the manner of obtaining the second string and the third string is similar to that of the first string and will not be elaborated here.

[0069] By splitting the first string of the preset class, the second string of the interception method, and the third string of the cancellation interception method into multiple first characters, multiple second characters, and multiple third characters respectively, when calling the interception method or the cancellation interception method in the preset class, the first characters are sorted and concatenated, so that the corresponding interception method or cancellation interception method can be called through the complete string obtained by concatenation, and the interception method or cancellation interception method in the preset class provided by the operating system can be successfully called.

[0070] In some embodiments, the first character, the second character, and the third character may be pre-split and stored in the target storage area. The target storage area may be an area in the terminal, for example, an area in the application program of the terminal.

[0071] In addition, when storing the first character, the second character, and the third character in the target storage area, in order to avoid interception restrictions on them by other application programs, they can be stored in the reverse order of the first characters in the string in the preset class. For example: the string in the preset class is "W K Browsing Context Controller", and it will be stored in the order of "Controller, Context, Browsing, K, W" when storing. When using, reverse the array, and then reverse the string and concatenate it into W K Browsing Context Controller.

[0072] Since the interception method will intercept the network requests of all pages, and the cancellation interception method will cancel the interception of the network requests of all pages, the enabling or disabling of the interception of the network requests of the target page can also be related to the network interception status of the target page.

[0073] In some embodiments, according to the switch control parameter, enabling or disabling the interception of the network requests of the target page includes: according to the switch control parameter and the network interception status of the target page, enabling or disabling the interception of the network requests of the target page. The network interception status includes interception or non-interception, and interception or non-interception respectively represents that the network requests of the target page have been intercepted or not intercepted.

[0074] In some embodiments, the network interception status is used to reflect that the network requests of the target page have been intercepted currently or not intercepted currently. As mentioned above, the interception method will intercept the network requests of all pages, and the cancellation interception method will cancel the interception of the network requests of all pages. Therefore, the interception status of the target page can be related to the previous page or the next page of the target page.

[0075] In some embodiments, the method further includes: in response to enabling or disabling the interception of network requests for the previous page or the next page of the target page in the application, determining the network interception status of the target page as intercepted or not intercepted, respectively.

[0076] Exemplarily, taking the target page as page B, the previous page of the target page as page A, and the next page of the target page as page C as an example, if the interception of the network request for the previous page "page A" is enabled, then all network requests for all pages will be intercepted at this time. Therefore, the network request status of page B is intercepted. Similarly, if the interception of the network request for the previous page "page A" is disabled, then the interception of all network requests for all pages will be cancelled at this time. Therefore, the network request status of page B is not intercepted. Similarly, the impact of the next page "page C" on the network interception status of the target page "page B" is the same as that of the previous page, which will not be elaborated here.

[0077] In some embodiments, the network interception status of the target page can be characterized by a variable carried by the target page. Exemplarily, the network interception status of the target page can be characterized by variable a. In some embodiments, the variable can be a Boolean (Bool) variable. The Boolean variable only includes 0 or 1. For example, 0 can represent not intercepted, and 1 can represent intercepted. Judging the network interception status of the target page through the Boolean variable, the logical judgment process is simple and efficient.

[0078] Exemplarily, still taking the target page as page B as an example, when jumping from page B to the next page "page C", since page B is not destroyed, that is, the variable of page B still exists, the network interception status of page B can be determined by the variable of page B at this time.

[0079] In some embodiments, enabling or disabling the interception of network requests for the target page according to the switch control parameter includes: when the switch control parameter is enabled and the network interception status is not intercepted, enabling the interception of network requests for the target page, and determining the network interception status of the target page as intercepted at a preset stage in the life cycle of the target page; when the switch control parameter is disabled and the network interception status is intercepted, disabling the interception of network requests for the target page, and determining the network interception status of the target page as not intercepted at a preset stage in the life cycle of the target page.

[0080] Exemplarily, taking the target page as page B as an example, when the network request control parameter of page B is enabled and the network interception status is non-intercepting, the interception of the network request for page B is enabled. Since the enabling of the network request interception is a global interception, at this time, the network interception status of page B should be changed from non-intercepting to intercepting. Correspondingly, at a preset stage in the life cycle of page B, the network interception status of page B is determined to be intercepting from non-intercepting. Similarly, the method of determining the network status of the target page to be non-intercepting is the same as the aforementioned method of determining to be intercepting, and will not be elaborated here.

[0081] In some embodiments, the life cycle of the target page can be generated according to the user's operations. Different user operations result in different life cycles of the page. The preset stage in the life cycle of the target page can refer to the View DidAppear stage of the target page.

[0082] Exemplarily, taking the target page as page B as an example, if the current user's operation is to return from page C to page B, at this time, the life cycle of page B will be generated. For example, the life cycle is: C[View Will Appear]→B[View WillAppear]→C[View Did Appear]→B[View Did Appear] where C[View Will Appear] represents the View Will Appear stage in the life cycle of page C, B[View Will Appear] represents the View Will Appear stage in the life cycle of page B, C[View Did Appear] represents the View DidAppear stage in the life cycle of page C, and B[View Did Appear] represents the View Did Appear stage in the life cycle of page B. Then, at this time, the network interception status of page B can be re-determined at the [View Did Appear] stage of page B. The specific details of the View WillAppear stage, View Did Appear stage, and View Did Appear stage can refer to the relevant prior art and will not be elaborated here.

[0083] Figure 2 It is a block diagram of a network request control device shown according to an exemplary embodiment. As Figure 2 shown, the network request control device 200 may include:

[0084] An acquisition module 210, configured to acquire a network request of a target page, where the target page is any page in an application;

[0085] The first determination module 220 is configured to determine the switch control parameter of the network request of the target page when the target page belongs to a preset type, where the switch control parameter includes on or off, and the on or the off respectively represents that it is necessary to turn on or off the interception of the network request of the target page;

[0086] The control module 230 is configured to, in response to the target page being opened, turn on or off the interception of the network request of the target page according to the switch control parameter.

[0087] In some embodiments, the control module 230 is further configured to:

[0088] Turn on or off the interception of the network request of the target page according to the switch control parameter and the network interception status of the target page, where the network interception status includes intercepted or not intercepted, and the intercepted or the not intercepted respectively represents that the network request of the target page has been intercepted or not intercepted.

[0089] In some embodiments, the device further includes:

[0090] The response module is configured to, in response to turning on or off the interception of the network request of the previous page or the next page of the target page in the application program, respectively determine the network interception status of the target page as the intercepted or the not intercepted.

[0091] In some embodiments, the control module 230 is further configured to:

[0092] When the switch control parameter is on and the network interception status is not intercepted, turn on the interception of the network request of the target page, and in a preset stage of the life cycle of the target page, determine the network interception status of the target page as intercepted;

[0093] When the switch control parameter is off and the network interception status is intercepted, turn off the interception of the network request of the target page, and in the preset stage of the life cycle of the target page, determine the network interception status of the target page as not intercepted.

[0094] In some embodiments, the control module 230 is further configured to:

[0095] Call the interception method or the cancellation interception method in the preset class provided by the operating system to enable or disable the interception of the network request for the target page. The interception method is used to enable the interception of network requests for all pages in the application, and the cancellation interception method is used to disable the interception of network requests for all pages.

[0096] In some embodiments, the control module 230 is further configured to:

[0097] Sort and splice the obtained multiple first characters and multiple second characters respectively to obtain a first string and a second string, and call the interception method in the preset class through the first string and the second string; or

[0098] Sort and splice the obtained multiple first characters and multiple third characters respectively to obtain a first string and a third string, and call the cancellation interception method in the preset class of the operating system through the first string and the third string;

[0099] Wherein, the first string is the string of the preset class, the second string is the string of the interception method, and the third string is the string of the cancellation interception method.

[0100] In some embodiments, the device further includes:

[0101] A search module, configured to search for the network request of the target page in a preset network request set, where the preset network request set includes multiple network requests belonging to the preset type;

[0102] A second determination module, configured to determine that the network request of the target web page belongs to the preset type when the network request of the target page is found in the preset network request set.

[0103] It should be noted that the device in the embodiments of the present invention corresponds to the method in the embodiments of the present invention, and other descriptions can refer to the description of the method in the embodiments of the present invention, which will not be repeated here.

[0104] Next, refer to Figure 3 , which shows a schematic structural diagram of an electronic device (such as the terminal device in Figure 1 ) 300 suitable for implementing the embodiments of the present invention. The terminal device in the embodiments of the present invention may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), in-vehicle terminals (such as in-vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc.Figure 3 The illustrated electronic device is merely an example and should not impose any limitation on the functions and scope of use of the embodiments of the present invention.

[0105] As Figure 3 shown, the electronic device 300 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage device 308 into a random access memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic device 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other through a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0106] Generally, the following devices may be connected to the I / O interface 305: an input device 306 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 308 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 309. The communication device 309 may allow the electronic device 300 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 3 the electronic device 300 with various devices is shown, it should be understood that it is not required to implement or include all the shown devices. More or fewer devices may be alternatively implemented or included.

[0107] Specifically, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes program codes for performing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication device 309, or installed from the storage device 308, or installed from the ROM 302. When the computer program is executed by the processing device 301, the above functions defined in the method of the embodiment of the present invention are performed.

[0108] It should be noted that the above-mentioned computer-readable medium of the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can 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 invention, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In the present invention, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, in which computer-readable program code is carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, and this computer-readable signal medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0109] In some embodiments, the client can communicate using any currently known or future-developed network protocol such as HTTP (HyperText Transfer Protocol), and can be interconnected with digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.

[0110] The above-mentioned computer-readable medium can be included in the above-mentioned electronic device; or it can exist separately and not be assembled into the electronic device.

[0111] The above computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to: obtain a network request for a target page, where the target page is any page in an application program; in the case where the target page belongs to a preset type, determine a switch control parameter for the network request of the target page, where the switch control parameter includes on or off, and the on or the off respectively represents that it is necessary to turn on or off the interception of the network request for the target page; in response to the target page being opened, according to the switch control parameter, turn on or off the interception of the network request for the target page.

[0112] Computer program code for performing the operations of the present invention may be written in one or more programming languages or combinations thereof. The above programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (for example, by using an Internet service provider to connect through the Internet).

[0113] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, may be implemented by a dedicated hardware-based system for performing the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.

[0114] The modules described in the embodiments of the present invention may be implemented in software or in hardware. Among them, the name of the module does not constitute a limitation to the module itself in some cases.

[0115] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. By way of example, and without limitation, the types of hardware logic components that can be used include: Field Programmable Gate Arrays (FPGA), Application Specific Integrated Circuits (ASIC), Application Specific Standard Products (ASSP), System on a Chip (SOC), Complex Programmable Logic Devices (CPLD), and the like.

[0116] In the context of the present invention, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on 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 foregoing.

[0117] The above description is only a preferred embodiment of the present invention and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of disclosure involved in the present invention is not limited to the technical solutions formed by the specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the technical solutions formed by mutually replacing the above features with the (but not limited to) technical features having similar functions disclosed in the present invention.

[0118] In addition, although the operations are depicted in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although a number of specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present invention. Certain features described in the context of separate embodiments can also be implemented combinatorially in a single embodiment. Conversely, the various features described in the context of a single embodiment can also be implemented separately or in any suitable sub-combination in multiple embodiments.

[0119] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. On the contrary, the specific features and acts described above are merely example forms for implementing the claims. Regarding the apparatus in the above embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method and will not be elaborated herein.

Claims

1. A network request control method, characterized in that, The method includes: Obtaining a network request for a target page, where the target page is any page in an application; When the target page belongs to a preset type, determining a switch control parameter for the network request of the target page, where the switch control parameter includes on or off, and the on or the off respectively represents that it is necessary to turn on or off the interception of the network request for the target page; In response to the target page being opened, according to the switch control parameter, turning on or off the interception of the network request for the target page; The turning on or off the interception of the network request for the target page includes: Invoking an interception method or a cancellation interception method in a preset class provided by the operating system to turn on or off the interception of the network request for the target page, where the interception method is used to turn on the interception of the network requests for all pages in the application, and the cancellation interception method is used to turn off the interception of the network requests for all pages; The invoking an interception method or a cancellation interception method in a preset class provided by the operating system includes: Sorting and concatenating a plurality of first characters and a plurality of second characters obtained to obtain a first string and a second string, and invoking the interception method in the preset class through the first string and the second string; or Sorting and concatenating a plurality of the first characters and a plurality of third characters obtained to obtain a first string and a third string, and invoking the cancellation interception method in the preset class of the operating system through the first string and the third string; Wherein, the first string is the string of the preset class, the second string is the string of the interception method, and the third string is the string of the cancellation interception method.

2. The network request control method according to claim 1, wherein The turning on or off the interception of the network request for the target page according to the switch control parameter includes: Turning on or off the interception of the network request for the target page according to the switch control parameter and the network interception state of the target page, where the network interception state includes intercepted or not intercepted, and the intercepted or the not intercepted respectively represents that the network request for the target page has been intercepted or not intercepted.

3. The network request control method according to claim 2, wherein The method further includes: In response to turning on or off the interception of the network request for the previous page or the next page of the target page in the application, determining the network interception state of the target page as intercepted or not intercepted respectively.

4. The network request control method according to claim 2, wherein The turning on or off the interception of the network request for the target page according to the switch control parameter includes: When the switch control parameter is on and the network interception state is not intercepted, turning on the interception of the network request for the target page, and determining the network interception state of the target page as intercepted at a preset stage in the life cycle of the target page; When the switch control parameter is off and the network interception status is interception, the interception of the network request for the target page is turned off, and at the preset stage of the life cycle of the target page, the network interception status of the target page is determined to be non-interception.

5. The network request control method according to claim 1, wherein After obtaining the network request of the target page, the method further includes: Search for the network request of the target page in a preset network request set, where the preset network request set includes multiple network requests belonging to the preset type; When the network request of the target page is found in the preset network request set, determine that the network request of the target page belongs to the preset type.

6. A network request control device, characterized in that, The device includes: An acquisition module configured to acquire a network request of a target page, where the target page is any page in an application; A first determination module configured to determine a switch control parameter of the network request of the target page when the target page belongs to a preset type, where the switch control parameter includes on or off, and on or off respectively represents that it is necessary to turn on or off the interception of the network request for the target page; A control module configured to, in response to the target page being opened, turn on or off the interception of the network request for the target page according to the switch control parameter; The control module is further configured to: Call an interception method or a cancellation interception method in a preset class provided by the operating system to turn on or off the interception of the network request for the target page, where the interception method is used to turn on the interception of the network requests for all pages in the application, and the cancellation interception method is used to turn off the interception of the network requests for all pages; The control module is further configured to: Sort and splice multiple first characters and multiple second characters respectively to obtain a first string and a second string, and call the interception method in the preset class through the first string and the second string; or Sort and splice multiple first characters and multiple third characters respectively to obtain a first string and a third string, and call the cancellation interception method in the preset class of the operating system through the first string and the third string; Wherein, the first string is the string of the preset class, the second string is the string of the interception method, and the third string is the string of the cancellation interception method.

7. A computer-readable medium, characterized in that, A computer program is stored thereon, and when the program is executed by a processing device, the steps of the network request control method according to any one of claims 1-5 are implemented.

8. An electronic device, characterized in that, The electronic device includes: A storage device having a computer program stored thereon; A processing device configured to execute the computer program in the storage device to implement the steps of the network request control method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Page interception method and system and secure desktop

    CN106027540A

  • Page access method and device

    CN111428163A