Method for acquiring uniform resource locator of browser and related device
By setting a hook function to detect new access events of the browser, the problem in the existing technology of injecting peripheral functions causing instability of the browser process is solved, and the security of obtaining the browser URL is improved.
Patent Information
- Application Number
- CN202411357983.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-01-21
AI Technical Summary
In the prior art, when obtaining the URL address of a browser, the browser process is insulated into peripheral functions, resulting in unstable or even crashes.
By setting up hook functions to detect new browser access events, there is no need to inject peripheral functions into the browser process, thereby avoiding potential interference.
It improves the security of obtaining the browser's uniform resource locator URL and avoids the instability of the browser process caused by the injection of peripheral functions.
Smart Images

Figure CN119341785A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network communication, and in particular to a method for obtaining a browser uniform resource locator and a related device. Background Art
[0002] With the development of network technology, network security has become an extremely important issue. When a network terminal has a browser behavior that is of interest to the control or audit policy, for the sake of network security, the browser access is generally blocked or audited based on the browser behavior and the browser URL address, combined with the control and audit policies, and the specific logs are reported to the control or audit end.
[0003] When obtaining the URL address of the browser, the prior art generally injects a target function into multiple functions of the browser process and monitors the behavior of the browser through the target function. However, this method of injecting the target function into the browser process injects a peripheral function into the browser process, which causes the browser process to become unstable or even crash during operation. Summary of the invention
[0004] The embodiment of the present invention provides a method and related device for obtaining a browser uniform resource locator, which is used to detect new access events of the browser by setting a hook function. This method of setting a hook function does not need to inject an external function into the browser process, thereby avoiding the potential interference of the external function on the running process of the browser process, thereby improving the security of obtaining the browser uniform resource locator URL.
[0005] A first aspect of an embodiment of the present application provides a method for obtaining a browser uniform resource locator, comprising:
[0006] Get the browser process ID;
[0007] Setting a hook function for a new access event of the browser according to the browser process identifier;
[0008] If the hook function detects the new access event, the type of the browser and the root UI element in the browser window are obtained through the UI automation interface;
[0009] Obtain a first UI element object tree to which the root UI element belongs;
[0010] According to the type of the browser, searching the first UI element object tree for a sub-UI element of a preset control type, where the preset control type includes a document control type, a toolbar control type, or an editable control type;
[0011] Get the control object whose control type is IUIAutomationLegacyIAccessiblePattern from the controls included in the child UI element;
[0012] The value of the control object is obtained, and the browser uniform resource locator is determined based on the value of the control object.
[0013] A second aspect of an embodiment of the present application provides a client, including:
[0014] An acquisition unit, used to acquire a browser process identifier;
[0015] A setting unit, used for setting a hook function for a new access event of the browser according to the browser process identifier;
[0016] The acquisition unit is further configured to acquire the type of the browser and the root UI element in the browser window through the UI automation interface if the hook function detects the new access event;
[0017] The acquisition unit is further used to acquire a first UI element object tree to which the root UI element belongs;
[0018] A retrieval unit, configured to retrieve, according to the type of the browser, a sub-UI element of a preset control type in the first UI element object tree, wherein the preset control type includes a document control type, a toolbar control type, or an editable control type;
[0019] The acquisition unit is further used to acquire a control object whose control type is IUIAutomationLegacyIAccessiblePattern from among the controls included in the sub-UI element;
[0020] The acquisition unit is further used to acquire the value of the control object and determine the browser uniform resource locator based on the value of the control object.
[0021] A third aspect of an embodiment of the present application provides a computer device, including a processor, which, when executing a computer program stored in a memory, is used to implement the method for obtaining a browser uniform resource locator provided in the first aspect of the embodiment of the present application.
[0022] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it is used to implement the method for obtaining a browser uniform resource locator provided in the first aspect of an embodiment of the present application.
[0023] A fifth aspect of an embodiment of the present application provides a computer program product on which a computer program is stored. When the computer program is executed by a processor, it is used to implement the method for obtaining a browser uniform resource locator provided in the first aspect of an embodiment of the present application.
[0024] It can be seen from the above technical solutions that the embodiments of the present invention have the following advantages:
[0025] In an embodiment of the present application, a browser process identifier is obtained; a hook function is set for a new access event of the browser according to the browser process identifier; if the hook function detects the new access event, the type of the browser and the root UI element in the browser window are obtained through the UI automation interface; the first UI element object tree to which the root UI element belongs is obtained; according to the type of the browser, child UI elements of a preset control type in the first UI element object tree are retrieved, and the preset control type includes a document control type, a toolbar control type or an editable control type; a control object whose control type is IUIAutomationLegacyIAccessiblePattern among the controls included in the child UI element is obtained; the value of the control object is obtained, and the value of the control object is used to determine the browser uniform resource locator.
[0026] Because the embodiment of the present application monitors new access events of the browser by setting a hook function for the browser process, and when a new access event of the browser is monitored, the browser type and the root UI element in the browser window are obtained through the UI automation interface of the browser, and the browser uniform resource locator is finally obtained by using the root UI element. Because the present application avoids the process of injecting peripheral functions into the browser process in the prior art by setting a hook function, thereby avoiding the potential interference with the running process of the browsing process caused by the injection of peripheral functions, thereby improving the security of the process of obtaining the browser uniform resource locator. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A schematic diagram of the architecture of a system for obtaining a browser uniform resource locator in an embodiment of the present application;
[0028] Figure 2 A schematic diagram of an embodiment of a method for obtaining a browser uniform resource locator in an embodiment of the present application;
[0029] Figure 3 This is a schematic diagram of a first UI element object tree in an embodiment of the present application;
[0030] Figure 4 The detailed steps of the process of obtaining the root UI element in the browser window through the UI automation interface in the embodiment of the present application;
[0031] Figure 5 A schematic diagram of another embodiment of the method for obtaining a browser uniform resource locator in an embodiment of the present application;
[0032] Figure 6 In the embodiment of this application Figure 2 A refinement of step 205 in the embodiment;
[0033] Figure 7 It is another detailed step of step 205 in the embodiment of the present application;
[0034] Figure 8 A schematic diagram of a first UI element object tree and a third UI element object tree in an embodiment of the present application;
[0035] Fig. 9 It is another detailed step of step 205 in the embodiment of the present application;
[0036] Fig.10 A schematic diagram of a first UI element object tree and a second UI element object tree in an embodiment of the present application;
[0037] Fig.11 It is another detailed step of step 205 in the embodiment of the present application;
[0038] Fig.12 This is a schematic diagram of an embodiment of a client in an embodiment of the present application. DETAILED DESCRIPTION
[0039] The embodiment of the present invention provides a method and related device for obtaining a browser uniform resource locator, which is used to detect new access events of the browser by setting a hook function. This method of setting a hook function does not need to inject an external function into the browser process, thereby avoiding the potential interference of the external function on the running process of the browser process, and improving the security of the process of obtaining the browser uniform resource locator URL.
[0040] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0041] The terms "first", "second", "third", "fourth", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0042] An embodiment of the present application provides a method for obtaining a browser uniform resource locator, the general principle of the method is: when it is necessary to obtain the uniform resource locator URL of the browser (wherein the URL is commonly known as the web page address, which is a standard resource address on the Internet and is also called a uniform resource locator), obtain the browser process identifier; set a hook function for a new access event of the browser according to the browser process identifier; if the hook function detects a new access event, obtain the type of the browser and the root UI element in the browser window; obtain the first UI element object tree to which the root UI element belongs; according to the type of the browser, retrieve the child UI elements of the preset control type in the first UI element object tree, the preset control type includes a document control type, a toolbar control type or an editable control type; obtain a control object whose control type is IUIAutomationLegacyIAccessiblePattern among the controls included in the child UI element; obtain the value of the control object, and determine the browser uniform resource locator with the value of the control object. Because the method for obtaining the browser uniform resource locator provided by the present application detects the new access behavior of the browser by setting a hook function for the new access event of the browser, and this method of setting the hook function is different from the method of injecting peripheral functions into the browser process in the prior art, thereby avoiding the potential interference with the operation of the browser process caused by the injection of peripheral functions, and improving the stability of the browser process operation in the process of obtaining the browser URL.
[0043] In order to better implement the above method for obtaining the browser uniform resource locator, the present application embodiment provides a system for obtaining the browser uniform resource locator. Figure 1 , Figure 1A schematic diagram of the architecture of a system for obtaining a browser uniform resource locator provided in an embodiment of the present application. The system may include at least one terminal device 101 and a server 102; different types of browsers may be installed on the terminal device 101, such as Google Chrome, Sogou Browser, Firefox, or IE browser. Server 102 may be used to receive access events of the browser installed in the terminal device 101. Server 102 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, etc.
[0044] Among them, the above-mentioned method for obtaining the browser uniform resource locator is executed by the terminal device 101. When the terminal device 101 needs to obtain the URL of the browser, the browser process identifier is obtained; a hook function is set for a new access event of the browser according to the browser process identifier; if the hook function detects a new access event, the type of browser and the root UI element in the browser window are obtained; the first UI element object tree to which the root UI element belongs is obtained; according to the type of browser, the child UI elements of the preset control type in the first UI element object tree are retrieved, and the preset control types include document control types, toolbar control types or editable control types; the control objects whose control types are IUIAutomationLegacyIAccessiblePattern in the controls included in the child UI elements are obtained; the value of the control object is obtained, and the value of the control object is used to determine the browser uniform resource locator.
[0045] For ease of understanding, the following describes the method for obtaining the browser uniform resource locator in this application. Figure 1 , an embodiment of the method for obtaining a browser uniform resource locator in an embodiment of the present application includes:
[0046] 201. Get the browser process ID;
[0047] Specifically, when the embodiment of the present application is executed by a terminal device, that is, a client, the client needs to obtain the uniform resource locator URL of the browser, and then first obtains the process identifier of the browser.
[0048] Among them, the browser process, also known as the rendering process or UI rendering process, is one of the core components of a web browser. Each browser usually has one or more such processes, which are responsible for parsing HTML documents, loading CSS styles, executing JavaScript code, and presenting web page content to users. When a browser opens a new tab or window, the browser will start a new process to process this page, which can maintain the independence and parallelism of each page and prevent the crash of one page from affecting other pages.
[0049] Furthermore, the browser process identifier is an identification code set for each browser process, so as to identify the process of each browser, wherein the browser process is generally identified by PID, and the browser process identifier PID can be viewed and obtained through the task manager.
[0050] 202. Setting a hook function for a new access event of the browser according to the browser process identifier;
[0051] After the process identifier PID of the browser is obtained, a hook function may be set for a new access event of the browser process through setWinEventHook, wherein the new access event of the browser refers to a new web page access event or an upload or download event of the browser.
[0052] Furthermore, when setting a hook function for a new access event of the browser process, parameter 5 of the hook function setWinEventHook can be set to the browser process, and parameter 7 of the hook function setWinEventHook can be set to a combination of constants WINEVENT_OUTOFCONTEXT and WINEVENT_SKIPOWNPROCESS. When parameter 7 of the hook function setWinEventHook is set to a combination of constants, it means that the hook function will not be mapped to the address space of the browser process that generates the event, thereby avoiding blocking the operation of the browser process.
[0053] 203. If the hook function detects a new access event, the type of the browser and the root UI element in the browser window are obtained through the UI automation interface;
[0054] Specifically, if the hook function detects a new access event, the client obtains the type of browser and the root UI (User Interface) element in the browser window.
[0055] Among them, when the client obtains the browser type, it is executed in the following way: the client can pre-store and maintain a mapping relationship table between the browser type and the browser process identifier. After obtaining the browser process identifier, the browser process identifier can be used to query the above mapping relationship table to obtain the browser type.
[0056] As for the process of further obtaining the root UI element in the browser window, it will be described in the following embodiments and will not be repeated here.
[0057] 204. Obtain the first UI element object tree to which the root UI element belongs;
[0058] After obtaining the root UI element in the browser window, you can query the first UI element object tree to which the root UI element belongs. The first UI element object tree stores a tree structure with the root UI element as the root, so that you can easily query and obtain the child UI elements in the root UI element. For easy understanding, Figure 3 A schematic diagram of the first UI element object tree is given.
[0059] 205. According to the type of the browser, retrieve the child UI element of the preset control type in the first UI element object tree, where the preset control type includes a document control type, a toolbar control type, or an editable control type;
[0060] After obtaining the first UI element object tree, the sub-UI elements of the preset control type in the first UI element object tree can be retrieved according to the type of browser, wherein the preset control type includes a document control type, a toolbar control type or an editable control type.
[0061] Specifically, because the types of browsers are different, when obtaining sub-UI elements, sub-UI elements of different types are correspondingly obtained. As for the relationship between the browser type and the sub-UI element type, it will be described in the following embodiments and will not be repeated here.
[0062] 206. Get the control object whose control type is IUIAutomationLegacyIAccessiblePattern from the controls included in the child UI element;
[0063] After obtaining the child UI elements of different control types in step 105, because the browser URL must be stored in the control object whose control type belongs to IUIAutomationLegacyIAccessiblePattern under the child UI element, the embodiment of the present application can obtain the control object whose control type is IUIAutomationLegacyIAccessiblePattern in the controls included in the child UI element.
[0064] Specifically, when obtaining a control object of type IUIAutomationLegacyIAccessiblePattern, the IUIAutomationElement::GetCurrentPatternAs method of the child UI element may be called to retrieve the control pattern interface identified as LegacyIAccessible in the child UI element, and then the control pattern interface of LegacyIAccessible may be used to obtain the control object of type IUIAutomationLegacyIAccessiblePattern.
[0065] 207. Get the value of the control object, and determine the browser uniform resource locator based on the value of the control object.
[0066] After obtaining a control object of type IUIAutomationLegacyIAccessiblePattern, the value of the control object is the browser uniform resource locator.
[0067] As an optional embodiment, when obtaining the value of the control object, the value of the control object of type IUIAutomationLegacyIAccessiblePattern may be obtained by calling the IUIAutomationLegacyIAccessiblePattern::get_CurrentValue method, and the value of the control object may be further determined as the uniform resource locator of the browser.
[0068] In an embodiment of the present application, a browser process identifier is obtained; a hook function is set for a new access event of the browser according to the browser process identifier; if the hook function detects the new access event, the type of the browser and the root UI element in the browser window are obtained through the UI automation interface; the first UI element object tree to which the root UI element belongs is obtained; according to the type of the browser, child UI elements of a preset control type in the first UI element object tree are retrieved, and the preset control type includes a document control type, a toolbar control type or an editable control type; a control object whose control type is IUIAutomationLegacyIAccessiblePattern among the controls included in the child UI element is obtained; the value of the control object is obtained, and the value of the control object is used to determine the browser uniform resource locator.
[0069] Because the embodiment of the present application monitors new access events of the browser by setting a hook function for the browser process, and when a new access event of the browser is monitored, the browser type and the root UI element in the browser window are obtained through the UI automation interface of the browser, and the browser uniform resource locator is finally obtained by using the root UI element. Because the present application avoids the process of injecting peripheral functions into the browser process in the prior art by setting a hook function, thereby avoiding the potential interference with the running process of the browsing process caused by the injection of peripheral functions, thereby improving the security of the process of obtaining the browser uniform resource locator.
[0070] based on Figure 2 In the embodiment described above, the process of obtaining the root UI element in the browser window through the UI automation interface in step 203 is described in detail below. Figure 4 , Figure 4 The detailed steps for obtaining the root UI element in the browser window through the UI Automation interface are as follows:
[0071] 401. Obtain the window handle of the browser from the hook function;
[0072] Because the window handle needs to be set in the hook function when setting the hook function, the embodiment of the present application can read the window handle carried by the hook function from the hook function.
[0073] Among them, the window handle is the memory address or pointer used by the operating system to uniquely identify a window, usually an integer or a specific data structure. It is a bridge between the browser and the window it creates, allowing the browser to control various properties of the window through the handle, such as maximizing, minimizing, closing, etc. In the Windows operating system, the window handle is often used for window message transmission and management.
[0074] 402. Determine whether the hook function detects a new access event for the first time. If so, execute step 403. If not, execute step 404.
[0075] Because when obtaining the root UI element of the browser window, the UI automation interface needs to be used, and when using the UI automation interface, a global singleton UI automation object needs to be created first. If the hook function detects a new access event for the first time, there is no global singleton UI automation object in the browser. Therefore, if the hook function detects a new access event for the first time, step 403 needs to be executed. If it is not the first time to detect a new access event, step 404 is executed.
[0076] 403. Generate a global singleton UI automation object;
[0077] Specifically, if the hook function detects a new access event for the first time, because there is no global singleton UI automation object in the browser, it is necessary to create a global singleton UI automation object first, which can be created through the following process:
[0078] First, call the CoInitialize function to initialize the current thread of the browser, and then call CoCreateInstance to generate a global singleton UI automation object of type IUIAutomation.
[0079] 404. Query the UI automation elements in the browser window using the window handle of the browser and the submethod of the global singleton UI automation object;
[0080] If the hook function is not detecting a new access event for the first time, it means that a global singleton UI automation object has been created in the browser. Then, the UI automation element in the browser window is queried using the browser window handle and the submethod of the global singleton UI automation object.
[0081] Specifically, after obtaining the global singleton UI automation object, the IUIAutomation::ElementFromHandle method of the global singleton UI automation object and the window handle of the browser can be called to retrieve the UI automation element in the browser window. After obtaining the UI automation element, the UI automation element is determined as the root UI element in the browser window.
[0082] 405. Determine the UI automation element as the root UI element.
[0083] After the UI automation element is obtained, the UI automation element is determined as the root UI element in the browser window.
[0084] The embodiment of the present application describes in detail the process of obtaining the root UI element in the browser window, and the embodiment of the present application obtains the root UI element in the browser window through a UI automation interface, thereby improving the convenience of obtaining the root UI element in the browser window.
[0085] based on Figure 2 The following describes in detail the method for obtaining the browser uniform resource locator. Figure 5 , Figure 5 Another embodiment of the method for obtaining a browser uniform resource locator:
[0086] 501. Get the browser process ID;
[0087] 502. Setting a hook function for a browser window top event or a browser window name change event according to the browser process identifier;
[0088] Specifically, in order to facilitate the monitoring of new access events of the browser window, we can usually monitor the browser's window top event and / or the browser's window name change event. Because generally when the browser's window top event and / or the browser's window name change event occurs, it can be determined with a high probability that a new window access event has occurred in the browser or an upload or download event has occurred in the browser.
[0089] Therefore, as an optional embodiment, a hook function may be set for the browser window top event or the browser window name change event, wherein the method of setting the hook function is similar to that described in step 202 and will not be repeated here.
[0090] 503. Obtain the window handle of the browser from a hook function that monitors the browser window top event or the browser window name change event;
[0091] After setting a hook function for a browser window top event or a browser window name change event, because the hook function carries the browser window handle, the embodiment of the present application can obtain the browser window handle from the hook function.
[0092] Because when a window pinning event or a window name change event occurs in the browser, it may not be a new access event that occurs in the browser. Therefore, in order to improve the event processing efficiency, the embodiment of the present application can also judge the correspondence between the browser window pinning event or the browser window name change event and the browser new access event through the following steps. Therefore, when it is determined that a new browser access event has occurred, the step of obtaining the browser uniform resource locator is executed, otherwise the hook function event is skipped to avoid wasting the computer's processing resources.
[0093] 504. According to the window handle of the browser, query the window class name corresponding to the window handle of the browser;
[0094] Specifically, as an optional embodiment, when determining the correspondence between the browser window top event or the browser window name change event and the browser new access event, the window class name corresponding to the browser window handle can be queried based on the browser window handle. The window class name is the type of the window handle.
[0095] 505. According to the window handle of the browser, query the browser process identifier corresponding to the window handle of the browser;
[0096] After obtaining the window handle of the browser, you can further obtain the browser process ID corresponding to the window handle.
[0097] As a specific embodiment, the GetWindowThreadProcessId interface may be queried according to the window handle, thereby obtaining the browser process identifier corresponding to the window handle.
[0098] 506. According to the browser process identifier, query the browser type corresponding to the browser process identifier;
[0099] After obtaining the process identifier of the browser, the mapping relationship table between the browser process identifier and the browser type stored in the client can be further queried to obtain the browser type corresponding to the browser process identifier.
[0100] 507. According to the browser type, obtain the window class name preset by the browser type;
[0101] Because each type of browser is provided with a preset window class name, an embodiment of the present application may compare the window class name queried using the browser window handle with the preset window class name corresponding to the browser type. If the two are the same, it means that the browser window pinning event and / or the browser window name changing event is indeed a new browser access event, and step 508 is executed; if the two are different, it means that the browser window pinning event and / or the browser window name changing event is not a corresponding new browser access event, and step 509 is executed.
[0102] 508. If the window class name corresponding to the window handle of the browser is the same as the window class name preset for the browser type, it is determined that a new access event has occurred in the browser window, and step 510 is triggered;
[0103] If the window class name queried using the browser window handle is the same as the preset window class name corresponding to the browser type, it is determined that a new access event has occurred in the browser window, and step 510 is triggered to continue to obtain the browser's uniform resource locator.
[0104] 509. If the window class name corresponding to the window handle of the browser is different from the window class name preset for the browser type, it is determined that no new access event occurs in the browser window, and the hook function monitoring event is terminated.
[0105] If the window class name queried using the browser window handle is different from the preset window class name corresponding to the browser type, it is determined that no new access event occurs in the browser window, and the hook function monitoring event is terminated.
[0106] 510. If the hook function detects a new access event, the type of the browser and the root UI element in the browser window are obtained through the UI automation interface;
[0107] 511. Obtain the first UI element object tree to which the root UI element belongs;
[0108] 512. According to the type of the browser, retrieve the child UI element of the preset control type in the first UI element object tree, where the preset control type includes a document control type, a toolbar control type, or an editable control type;
[0109] 513. Get the control object whose control type is IUIAutomationLegacyIAccessiblePattern from the controls included in the child UI element;
[0110] 514. Get the value of the control object, and determine the browser uniform resource locator based on the value of the control object.
[0111] It should be noted that steps 510 to 514 are similar to Figure 2 The descriptions of step 203 to step 207 in the embodiment are similar and will not be repeated here.
[0112] In an embodiment of the present application, the correspondence between the browser window pinning event and / or the browser window name change event and the browser new access event is further determined by comparing the window class name, and when it is further determined that a browser new access event has occurred, the browser's uniform resource locator is further obtained. When a browser new access event has not occurred, the hook event is terminated, thereby improving the processing efficiency of the entire event and avoiding the waste of processor resources in the client.
[0113] based on Figure 2 In the embodiment described above, the process of retrieving the sub-UI elements of the preset control type in the first UI element object tree according to the type of the browser is further described in detail below:
[0114] 1. If the browser types include: Google Chrome and / or Sogou Browser;
[0115] See also Figure 6 , Figure 6 A refinement of step 205:
[0116] 601. If the browser type includes Google Chrome and / or Sogou Browser, calling a submethod of the global singleton UI automation object to create a search condition for searching the document control type;
[0117] If the browser is Google Chrome and / or Sogou Browser, the child UI elements belonging to the document control type in the first UI element object tree are retrieved, so it is necessary to first call the child method of the global singleton UI automation object to create a retrieval condition for retrieving the document control type.
[0118] As a specific implementation, when creating a retrieval condition for retrieving a document control type, the embodiment of the present application may call the IUIAutomation::CreatePropertyCondition method of the UI automation object and set the parameters of the method to the numbers UIA_ControlTypePropertyId and 0xC36E (indicating the document control type), thereby obtaining the retrieval condition for retrieving the document control type.
[0119] 602. Retrieve the first child UI element of the document control type in the first UI element object tree by using the retrieval condition for retrieving the document control type and the child method of the root UI element.
[0120] After obtaining the retrieval condition for retrieving the document control type, the retrieval condition and the sub-method of the root UI element are used to retrieve the first child UI element belonging to the document control type in the first UI element object tree, because the browser uniform resource locator exists in the node of the child UI element.
[0121] As a specific implementation, when retrieving the first child UI element of the document control type in the first UI element object tree, the IUIAutomationElement::FindFirst method of the root UI element may be called to obtain the first child UI element of the document control type in the first UI element object tree.
[0122] In an embodiment of the present application, a detailed description is given of the process of obtaining the first sub-UI element of the document control type in the first UI element object tree when the browser type is Google Chrome and / or Sogou Browser, thereby improving the convenience of obtaining the sub-UI elements containing the browser uniform resource locator in Google Chrome and / or Sogou Browser in the present application.
[0123] 2. The types of browsers include: Google Chrome;
[0124] See also Figure 7 , Figure 7 Another refinement of step 205:
[0125] When Google Chrome cannot Figure 6 When the embodiment obtains the first child UI element belonging to the document type control, it can also execute Figure 7 The method steps in the embodiment:
[0126] 701. If the browser includes Google Chrome, traverse the first UI element object tree to obtain the last child element of the root element in the first UI element object tree;
[0127] If the browser includes Google Chrome, the first UI element object tree may also be traversed to obtain the last child element of the root element in the first UI element object tree.
[0128] As a specific implementation method, the IUIAutomation::get_ControlViewWalker submethod of the global singleton automation object may be called to obtain a traversal object of type IUIAutomationTreeWalker, and based on the traversal object of type IUIAutomationTreeWalker, the IUIAutomationTreeWalker::GetLastChildElement submethod of the traversal object may be called to obtain the last child element of the root element in the first UI element object tree.
[0129] 702. Determine a third UI element object tree with the last child element as the root element;
[0130] After the last child element of the root element in the first UI element object tree is obtained, a third UI element object tree with the last child element as the root element is determined.
[0131] For ease of understanding, Figure 8 A schematic diagram of a first document control type child UI element in a first UI element object tree and a third UI element object tree with the last child element as the root element is given.
[0132] 703. Call a submethod of the global singleton UI automation object to create a search condition for searching the document control type;
[0133] After obtaining the third UI element object tree, a submethod of the global singleton UI automation object is called to create a search condition for searching the document control type. The description of this step is similar to that of step 601 and will not be repeated here.
[0134] 704. Retrieve the first child UI element of the document control type in the third UI element object tree by using the retrieval condition for retrieving the document control type and the child method of the last child element.
[0135] After obtaining the search condition for searching the document control type and the last child UI element, the sub-method of the last child element is called to use the search condition to search for the first child UI element of the document control type in the third UI element object tree.
[0136] The process of retrieving the first sub-UI element of the document control type in the third UI element object tree is similar to the process of retrieving the first sub-UI element of the document control type in the first UI element object tree in step 602, and will not be repeated here.
[0137] In an embodiment of the present application, when the first child UI element of the document control type cannot be retrieved using the first UI element object tree, a process of using the submethod of the last child element to retrieve the first child UI element of the document control type in the third UI element object tree is described in detail, thereby increasing the possibility of obtaining the first child UI element of the document control type.
[0138] 3. If the browser type includes: Firefox;
[0139] See also Fig. 9 , Fig. 9 Another refinement of step 205 is as follows:
[0140] 901. If the category of the browser includes Firefox, calling a submethod of the global singleton UI automation object to create a search condition for searching a toolbar control type and an editable control type;
[0141] If the browser is Firefox, the search condition is to search for the first child UI element of the toolbar control type in the first UI element object tree and the first child UI element of the editable control type in the second element object tree.
[0142] As a specific embodiment, the submethod IUIAutomation::CreatePropertyCondition of the global singleton UI automation object is called to create search conditions for searching the toolbar control type and the editable control type, and then steps 902 and 905 are executed respectively according to the search conditions for searching the toolbar control type and the editable control type.
[0143] 902. Retrieve the first child UI element of the toolbar control type in the first UI element object tree by using the retrieval condition for retrieving the document control type and the child method of the root UI element;
[0144] After the search condition for searching the toolbar control type is obtained, the search condition and the sub-method of the root UI element are used to search for the first sub-UI element of the toolbar control type in the first UI element object tree.
[0145] As a specific embodiment, the IUIAutomationElement::FindFirst submethod of the root UI element is called to retrieve the first child UI element of the toolbar control type in the first UI element object tree.
[0146] 903. Obtain the second sibling UI element after the first child UI element of the toolbar control type in the first UI element object tree;
[0147] After obtaining the first child UI element of the toolbar control type in the first UI element object tree, the second brother UI element after the child UI element is obtained. For ease of understanding, Fig.10 A schematic diagram of a first UI element object tree and a second UI element object tree is given.
[0148] 904. Determine a second UI element object tree with the second brother UI element as a root element;
[0149] After obtaining the second brother UI element, a second UI element object tree with the second brother UI element as the root element is determined.
[0150] 905. Retrieve the first child UI element of the editable control type in the second UI element object tree by using the search condition for retrieving the editable control type and the child method of the second brother UI element.
[0151] Then, the search condition for searching the editable control type created in step 901 and the sub-method of the second brother UI are used to search for the first child UI element of the editable control type in the second UI element object tree.
[0152] As a specific embodiment, the IUIAutomationElement::FindFirst submethod of the second sibling UI element is called to retrieve the first child UI element of the editable control type in the second UI element object tree, because the browser uniform resource locator exists in the node of the child UI element.
[0153] In an embodiment of the present application, a detailed description is given of the process of retrieving the first child UI element of the editable control type in the second UI element object tree when the browser type is Firefox, thereby improving the convenience of determining the child UI element containing the browser uniform resource locator in the Firefox browser.
[0154] 4. If the browser includes IE browser;
[0155] See also Fig.11 , Fig.11 Another refinement of step 205:
[0156] 1101. If the category of the browser includes the IE browser, a submethod of the global singleton UI automation object is called to create a search condition for searching the editable control type;
[0157] If the browser is IE browser, a submethod of the global singleton UI automation object is called to create a search condition for searching the editable control type.
[0158] As a specific implementation, the submethod IUIAutomation::CreatePropertyCondition of the global singleton UI automation object is called to create a retrieval condition for retrieving the editable control type, and step 1102 is executed using the retrieval condition.
[0159] 1102. Retrieve the first child UI element of the editable control type in the first UI element object tree by using the search condition for retrieving the editable control type and the child method of the root UI element.
[0160] After creating the search condition for searching the editable control type in step 1101, the search condition and the sub-method of the root UI element are used to search for the first child UI element of the editable control type in the first UI element object tree.
[0161] As a specific implementation, the IUIAutomationElement::FindFirst submethod of the root UI element is called to retrieve the first child UI element of the editable control type in the first UI element object tree.
[0162] In an embodiment of the present application, a detailed description is given of the process of retrieving the first sub-UI element of the editable control type in the first UI element object tree when the browser type is an IE browser, thereby improving the convenience of determining the sub-UI element containing the browser uniform resource locator in the IE browser.
[0163] based on Figures 2 to 11 In the described embodiment, after obtaining the uniform resource locator of the browser, in order to control and audit the behavior of the browser, the embodiment of the present application can also input the uniform resource locator of the browser into the client, so that the client can control or audit the new access event behavior of the browser according to the URL of the browser and the pre-set control policy or audit policy.
[0164] It is understandable that, in various embodiments of the present invention, the sequence numbers of the above steps do not mean the order of execution. The order of execution of the steps should be determined by their functions and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0165] The above describes in detail the method for obtaining the browser uniform resource locator in the embodiment of the present application. The following describes in detail the client in the embodiment of the present application. Fig.12 , an embodiment of the client in the embodiment of the present application includes:
[0166] The acquisition unit 1201 is used to acquire the browser process identifier;
[0167] A setting unit 1202, configured to set a hook function for a new access event of the browser according to the browser process identifier;
[0168] The acquisition unit 1201 is further configured to acquire the type of the browser and the root UI element in the browser window through the UI automation interface if the hook function detects a new access event;
[0169] The acquiring unit 1201 is further used to acquire the first UI element object tree to which the root UI element belongs;
[0170] The retrieval unit 1203 is used to retrieve, according to the type of the browser, a sub-UI element of a preset control type in the first UI element object tree, where the preset control type includes a document control type, a toolbar control type, or an editable control type;
[0171] The acquisition unit 1201 is further used to acquire a control object whose control type is IUIAutomationLegacyIAccessiblePattern from among the controls included in the child UI element;
[0172] The acquisition unit 1201 is further used to acquire the value of the control object and determine the browser uniform resource locator based on the value of the control object.
[0173] As an optional embodiment, the acquiring unit 1201 is specifically configured to:
[0174] Get the browser's window handle from the hook function;
[0175] Query the UI Automation elements in the browser window using the browser window handle and the submethods of the global singleton UI Automation object;
[0176] Identifies a UI Automation element as the root UI element.
[0177] As an optional embodiment, the client further includes:
[0178] The generating unit 1204 is used to generate a global singleton UI automation object before querying the UI automation elements in the browser window using the window handle of the browser and the submethod of the global singleton UI automation object if the hook function detects a new access event for the first time.
[0179] As an optional embodiment, the new access event of the browser includes a browser window top event or a browser window name change event;
[0180] The acquisition unit 1201 is further configured to acquire the window handle of the browser from the hook function that monitors the browser window top event or the browser window name change event before acquiring the type of the browser and the root UI element in the browser window after the hook function detects the new access event;
[0181] The client also includes:
[0182] The query unit 1205 is used to query the window class name corresponding to the window handle of the browser according to the window handle of the browser, query the browser process identifier corresponding to the window handle of the browser according to the window handle of the browser; and query the browser type corresponding to the browser process identifier according to the browser process identifier;
[0183] The acquisition unit 1201 is further used to acquire a window class name preset for the browser type according to the browser type;
[0184] The client also includes:
[0185] The determining unit 1206 is configured to determine that a new access event has occurred in the browser window if the window class name corresponding to the window handle of the browser is the same as the window class name preset for the browser type, thereby triggering a step of obtaining the browser type and the root UI element in the browser window;
[0186] If the window class name corresponding to the window handle of the browser is different from the window class name preset for the browser type, it is determined that no new access event occurs in the browser window, and the hook function monitoring event is terminated.
[0187] As an optional embodiment, the acquiring unit 1201 is specifically configured to:
[0188] According to the browser process identifier, a mapping table between browser detection identifiers and browser types pre-stored in the client is queried to obtain the type of the browser.
[0189] As an optional embodiment, if the type of the browser includes Google Chrome and / or Sogou Browser, the retrieval unit 1203 is specifically used to:
[0190] Calling a submethod of the global singleton UI automation object to create a search condition for retrieving the document control type;
[0191] The first child UI element belonging to the document control type in the first UI element object tree is retrieved by using the retrieval condition for retrieving the document control type and the child method of the root UI element.
[0192] As an optional embodiment, if the type of the browser includes Firefox, the retrieval unit 1203 is specifically used for:
[0193] Calling a submethod of a global singleton UI automation object through a UI automation interface to create a search condition for searching the toolbar control type and the editable control type;
[0194] Retrieve the first child UI element of the toolbar control type in the first UI element object tree by using the retrieval condition for retrieving the document control type and the child method of the root UI element;
[0195] Obtaining, in the first UI element object tree, a second sibling UI element after a first child UI element of the toolbar control type;
[0196] Determine a second UI element object tree with the second sibling UI element as a root element;
[0197] The first child UI element belonging to the editable control type in the second UI element object tree is retrieved by using the retrieval condition for retrieving the editable control type and the sub-method of the second sibling UI element.
[0198] As an optional embodiment, if the type of the browser includes the IE browser, the retrieval unit 1203 is specifically used to:
[0199] Calling a submethod of the global singleton UI automation object to create a search condition for retrieving the editable control type;
[0200] The first child UI element belonging to the editable control type in the first UI element object tree is retrieved by using the retrieval condition for retrieving the editable control type and the child method of the root UI element.
[0201] As an optional embodiment, if the type of the browser includes Google Chrome, the retrieval unit 1203 is specifically used to:
[0202] Traversing the first UI element object tree to obtain the last child element of the root element in the first UI element object tree;
[0203] Determine a third UI element object tree with the last child element as the root element;
[0204] Calling a submethod of the global singleton UI automation object to create a search condition for retrieving the document control type;
[0205] The first child UI element belonging to the document control type in the third UI element object tree is retrieved by using the retrieval condition for retrieving the document control type and the sub-method of the last child element.
[0206] As an optional embodiment, the client further includes:
[0207] The input unit 1207 is used to input the browser uniform resource locator into the client, wherein the client is used to use the browser uniform resource locator to control or audit the new access event behavior of the browser.
[0208] It should be noted that the functions of the above-mentioned units are similar to those described in the method embodiment and will not be repeated here.
[0209] Because the embodiment of the present application monitors new access events of the browser by setting a hook function for the browser process by setting unit 1202, and when a new access event of the browser is monitored, the acquisition unit 1201 is used to obtain the type of browser and the root UI element in the browser window through the UI automation interface of the browser, and the root UI element is used to finally obtain the browser uniform resource locator. Because the present application avoids the process of injecting peripheral functions into the browser process in the prior art by setting the hook function, thereby avoiding the potential interference with the running process of the browsing process due to the injection of peripheral functions, thereby improving the security of the process of obtaining the browser uniform resource locator.
[0210] The present application also provides a computer program product, including a computer program, which, when executed by a processor, is used to implement Figures 2 to 11 The method steps are described in the method embodiments.
[0211] The computer device in the embodiment of the present invention is described below from the perspective of hardware processing:
[0212] The computer device is used to implement the functions of the client. In an embodiment of the present invention, an embodiment of the computer device includes:
[0213] Processor and memory;
[0214] When the memory is used to store a computer program and the processor is used to execute the computer program stored in the memory, the method steps described in the above method embodiment can be implemented.
[0215] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that a processor and a memory are merely examples of computer devices and do not constitute a limitation of the computer device. The computer device may include more or fewer components, or a combination of certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, and the like.
[0216] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the computer device, and uses various interfaces and lines to connect various parts of the entire computer device.
[0217] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the computer device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the terminal, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0218] The present invention also provides a computer-readable storage medium, which is used to implement the functions of a client and stores a computer program. When the computer program is executed by a processor, the processor can be used to implement the method steps described in the above method embodiment.
[0219] It is understandable that if the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a corresponding computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned corresponding embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0220] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0221] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0222] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0223] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for obtaining a browser uniform resource locator, characterized in that: include: Get the browser process ID; Setting a hook function for a new access event of the browser according to the browser process identifier; If the hook function detects the new access event, the type of the browser and the root UI element in the browser window are obtained through the UI automation interface; Obtain a first UI element object tree to which the root UI element belongs; According to the type of the browser, searching the first UI element object tree for a sub-UI element of a preset control type, where the preset control type includes a document control type, a toolbar control type, or an editable control type; Get the control object whose control type is IUIAutomationLegacyIAccessiblePattern from the controls included in the child UI element; The value of the control object is obtained, and the browser uniform resource locator is determined based on the value of the control object.
2. The method according to claim 1, characterized in that The step of obtaining the root UI element in the browser window through the UI automation interface includes: Get the window handle of the browser from the hook function; Querying UI automation elements in the browser window using the window handle of the browser and a submethod of a global singleton UI automation object; The UI automation element is determined as the root UI element.
3. The method according to claim 2, characterized in that Before querying the UI automation element in the browser window by using the window handle of the browser and the submethod of the global singleton UI automation object, the method further includes: If the hook function detects the new access event for the first time, a UI automation object of the global singleton is generated.
4. The method according to claim 1, characterized in that: The new access event of the browser includes a browser window top event or a browser window name change event; After the hook function detects the new access event, before obtaining the type of the browser and the root UI element in the browser window, the method further includes: Obtaining the window handle of the browser from a hook function that monitors the browser window top event or the browser window name change event; According to the window handle of the browser, query the window class name corresponding to the window handle of the browser; According to the window handle of the browser, query the browser process identifier corresponding to the window handle of the browser; According to the browser process identifier, querying the browser type corresponding to the browser process identifier; According to the browser type, obtaining the window class name preset for the browser type; If the window class name corresponding to the window handle of the browser is the same as the window class name preset for the browser type, it is determined that a new access event has occurred in the browser window, and the step of obtaining the browser type and the root UI element in the browser window is triggered; If the window class name corresponding to the window handle of the browser is different from the window class name preset for the browser type, it is determined that no new access event occurs in the browser window, and the hook function monitoring event is terminated.
5. The method according to claim 1, characterized in that The method for obtaining the type of browser includes: According to the browser process identifier, a mapping table between the browser process identifier and the browser type pre-stored in the client is queried to obtain the type of the browser.
6. The method according to claim 1, characterized in that The types of browsers include: Google Chrome and / or Sogou Browser; According to the type of the browser, searching the first UI element object tree for a sub-UI element of a preset control type, where the preset control type includes a document control type, a toolbar control type, or an editable control type, including: If the type of the browser includes the Google Chrome and / or the Sogou Browser, calling a submethod of the global singleton UI automation object to create a retrieval condition for retrieving the document control type; The first child UI element belonging to the document control type in the first UI element object tree is retrieved by using the retrieval condition for retrieving the document control type and the child method of the root UI element.
7. The method according to claim 1, characterized in that The types of browsers include: Firefox; According to the type of the browser, searching the first UI element object tree for a sub-UI element of a preset control type, where the preset control type includes a document control type, a toolbar control type, or an editable control type, including: If the category of the browser includes the Firefox browser, calling a submethod of the global singleton UI automation object to create a retrieval condition for retrieving the toolbar control type and the editable control type; Retrieve the first child UI element of the toolbar control type in the first UI element object tree by using the retrieval condition for retrieving the document control type and the child method of the root UI element; Obtaining, in the first UI element object tree, a second sibling UI element after a first child UI element of the toolbar control type; Determine a second UI element object tree with the second sibling UI element as a root element; The first child UI element belonging to the editable control type in the second UI element object tree is retrieved by using the retrieval condition for retrieving the editable control type and the sub-method of the second sibling UI element.
8. The method according to claim 1, characterized in that The types of browsers include: Internet Explorer; According to the type of the browser, searching the first UI element object tree for a sub-UI element of a preset control type, where the preset control type includes a document control type, a toolbar control type, or an editable control type, including: If the category of the browser includes the IE browser, calling a submethod of the global singleton UI automation object to create a retrieval condition for retrieving the editable control type; The first child UI element belonging to the editable control type in the first UI element object tree is retrieved by using the retrieval condition for retrieving the editable control type and the child method of the root UI element.
9. The method according to claim 1, characterized in that: The types of browsers include: Google Chrome; According to the type of the browser, searching the first UI element object tree for a sub-UI element of a preset control type, where the preset control type includes a document control type, a toolbar control type, or an editable control type, including: If the browser includes the Google Chrome, traversing the first UI element object tree to obtain the last child element of the root element in the first UI element object tree; Determine a third UI element object tree with the last child element as the root element; Calling a submethod of the global singleton UI automation object to create a search condition for retrieving the document control type; The first child UI element belonging to the document control type in the third UI element object tree is retrieved by using the retrieval condition for retrieving the document control type and the sub-method of the last child element.
10. The method according to any one of claims 1 to 9, characterized in that After determining the browser uniform resource locator, the method further includes: The browser uniform resource locator is input into the client, wherein the client is used to control or audit the new access event behavior of the browser by using the browser uniform resource locator.
11. A client, characterized in that: include: An acquisition unit, used to acquire a browser process identifier; A setting unit, used for setting a hook function for a new access event of the browser according to the browser process identifier; The acquisition unit is further configured to acquire the type of the browser and the root UI element in the browser window through the UI automation interface if the hook function detects the new access event; The acquisition unit is further used to acquire a first UI element object tree to which the root UI element belongs; A retrieval unit, configured to retrieve, according to the type of the browser, a sub-UI element of a preset control type in the first UI element object tree, wherein the preset control type includes a document control type, a toolbar control type, or an editable control type; The acquisition unit is further used to acquire a control object whose control type is IUIAutomationLegacyIAccessiblePattern from among the controls included in the sub-UI element; The acquisition unit is further used to acquire the value of the control object and determine the browser uniform resource locator based on the value of the control object.
12. A computer device comprising a processor, characterized in that: When executing the computer program stored in the memory, the processor is used to implement the method for obtaining the browser uniform resource locator according to any one of claims 1 to 10.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it is used to implement the method for obtaining a browser uniform resource locator according to any one of claims 1 to 10.
14. A computer program product having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it is used to implement the method for obtaining a browser uniform resource locator according to any one of claims 1 to 10.