A remote browser navigation control method, apparatus, device and medium

CN122903709APending Publication Date: 2026-10-13ZIXUN TECHNOLOGY (FUJIAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610848663.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-12
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

第一,状态不同步

Benefits of technology

1、本发明通过客户端拦截原生导航指令并转换为自定义请求发送至服务端,由服务端直接操作远程浏览器实例的真实历史堆栈索引,避免了因直接调用本地导航控制器导致的状态不同步问题,确保了用户界面与远程浏览器画面的一致性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122903709A_ABST
    Figure CN122903709A_ABST
Patent Text Reader

Abstract

The application provides a remote browser navigation control method, device, equipment and medium, the method comprises the following steps: the client judges whether the current tab page is in a remote isolation environment in response to the forward or backward operation of the user, and if so, the native navigation instruction is intercepted and a navigation request is sent to the server. The server locates the remote browser instance according to the tab page identifier, obtains the real history stack and the current index through the Chrome DevTools Protocol, determines the target history item according to the operation type, and instructs the remote browser to jump to the history item; through the interception of the redirection mechanism and the history index backtracking of the server, the closed-loop navigation of local triggering and remote response is realized, the form data and the page state can be completely preserved, multiple window concurrent isolation is supported, and the local and remote hybrid mode is compatible.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of remote browser technology, and in particular to a remote browser navigation control method, apparatus, device, and medium. Background Technology

[0002] In traditional browser architectures, forward and back navigation operations are handled directly by the browser kernel's built-in NavigationController. This controller maintains the history stack of the current tab, and when the user clicks the forward or back button, the kernel loads the corresponding history page based on the stack index.

[0003] With increasing demands for network security, Remote Browser Isolation (RBI) technology is becoming more widespread. In RBI mode, the client acts only as a rendering shell, responsible for displaying the browser instance on a remote server, while the actual page rendering, script execution, and history stack are stored on the remote server. This architecture effectively isolates direct interaction between the terminal device and internet content, preventing malicious code from intruding into the local environment.

[0004] However, the aforementioned remote isolation architecture introduces new technical challenges to browser navigation control: First, there is a state asynchrony. If the client's local navigation controller is called directly in RBI mode to execute the goBack() or goForward() method, the local kernel will attempt to jump to the local history, while the browser instance on the remote server remains unchanged, resulting in a serious mismatch between the URL displayed in the user interface and the actual screen.

[0005] Second, control failure. In a remote isolation environment, the client may not maintain any history stack at all. In this case, clicking the back or forward button will have no response, resulting in a very poor user experience.

[0006] Third, page state loss. Some existing RBI solutions use URL redirection to implement forward and backward navigation. This means the server calculates the target page's URL based on user actions and then instructs the remote browser to load that URL. This URL-based redirection method results in the loss of all temporary information on the page, such as form data, scroll position, and iframe state. Users need to re-enter forms or relocate the page content.

[0007] Fourth, concurrency conflicts. In scenarios where multiple windows or tabs are used in parallel, how to accurately deliver back or forward commands to the corresponding remote browser instances and avoid command interference is also a problem that urgently needs to be solved.

[0008] Therefore, there is an urgent need for a browser navigation control solution that can achieve accurate and stateful navigation control in a remote, isolated environment. Summary of the Invention

[0009] The technical problem to be solved by the present invention is to provide a remote browser navigation control method, device, equipment and medium. By intercepting and redirecting mechanisms and backtracking the server-side historical index, a closed-loop navigation of local triggering and remote response is realized. It can completely retain form data and page state, support multi-window concurrent isolation, and is compatible with local and remote mixed modes.

[0010] In a first aspect, the present invention provides a remote browser navigation control method, comprising: The client responds to the user's forward or back action and determines whether the current tab is in a remote isolation environment; If the current tab is in a remote isolation environment, the client intercepts the native navigation command and sends a navigation request to the server through a communication protocol; the navigation request includes at least the operation type and tab identifier, and the operation type is either a forward operation or a back operation; The server receives the navigation request, locates the corresponding remote browser instance based on the tab identifier, and obtains the real history stack and current index of the remote browser instance through CDP. The server determines the target history entry from the real history stack based on the operation type and the current index, and instructs the remote browser instance to jump to the target history entry via CDP.

[0011] In a second aspect, the present invention provides a remote browser navigation control device, comprising: The response module allows the client to respond to the user's forward or back actions and determine whether the current tab is in a remote isolation environment. If the current tab is in a remote isolation environment, the interception module intercepts the native navigation instructions and sends a navigation request to the server via a communication protocol. The navigation request includes at least an operation type and a tab identifier, where the operation type is either a forward operation or a back operation. The information acquisition module receives the navigation request, locates the corresponding remote browser instance based on the tab identifier, and obtains the real history stack and current index of the remote browser instance through CDP. The operation module, the server determines the target history entry from the real history stack according to the operation type and the current index, and instructs the remote browser instance to jump to the target history entry through CDP.

[0012] Thirdly, the present invention provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in the first aspect.

[0013] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0014] One or more technical solutions provided by this invention have at least the following technical effects or advantages: 1. This invention intercepts native navigation commands on the client side and converts them into custom requests, which are then sent to the server. The server then directly manipulates the real historical stack index of the remote browser instance, avoiding the state asynchrony problem caused by directly calling the local navigation controller and ensuring the consistency between the user interface and the remote browser screen.

[0015] 2. This invention obtains the history stack of a remote browser through the CDP's Page.getNavigationHistory directive, and then navigates to the entry by ID using the Page.navigateToHistoryEntry directive, instead of using the traditional URL redirection method. This mechanism ensures that temporary information such as form input data, scroll position, and iframe child page state are completely preserved after navigating forward and backward, eliminating the need for users to re-enter forms or reposition the page, significantly improving the user experience.

[0016] 3. This invention introduces a sessionId binding mechanism, establishing an independent CDP session for each remote browser instance on the server side, and associating and storing the sessionId with the client tab identifier. CDP commands corresponding to different sessions are executed concurrently without interference, enabling users to open multiple remote isolated tabs or windows simultaneously, each independently performing forward and backward operations.

[0017] 4. This invention dynamically determines whether the current tab belongs to a remote isolated environment by checking the environment identifier on the client side. Remote tabs are intercepted and processed remotely, while ordinary tabs are handled by the local native navigation controller. Both processing modes maintain a consistent user interface, allowing the same client application to manage multiple tabs in both ordinary and remote isolated environments simultaneously, thus expanding the application's applicability.

[0018] 5. This invention designs a complete set of exception handling and degradation strategies. When communication between the client and server is interrupted, the client can promptly disable the forward and back buttons and prompt the user; when the server's CDP command execution times out or fails, the client can execute corresponding degradation strategies based on the error code, such as temporarily disabling navigation buttons, prompting the user to refresh, or reverting to local navigation processing. These mechanisms effectively avoid unresponsiveness or interface freezes caused by network anomalies or server failures.

[0019] 6. This invention handles all historical stack maintenance and navigation calculation logic on the server side, while the client is only responsible for triggering and presenting results, without needing to maintain the historical records of remote tabs. This architecture reduces the implementation complexity of the client and facilitates unified upgrades and maintenance of navigation logic on the server side.

[0020] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0021] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0022] Figure 1 This is a flowchart of the method in Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of the device in Embodiment 2 of the present invention. Detailed Implementation

[0023] The overall concept of the technical solution in this application is as follows: This solution rewrites the `goBack` and `goForward` methods of Tab on the Android client. By judging the business identifier, it intercepts the native navigation behavior and transforms it into a custom command to be sent to the server. After receiving the command, the server uses `Page.getNavigationHistory` of CDP (Chrome DevTools Protocol) to obtain the real history stack of the remote instance, and uses `Page.navigateToHistoryEntry` to precisely control the remote page jump, realizing a closed-loop navigation of "local trigger, remote response".

[0024] In "Environment A" of an isolated browser, a user clicks three links consecutively. When the user then presses the Android physical back button, the system needs to recognize that the tab belongs to a controlled environment and notify the remote server to redirect the page back to the view of the second link, while maintaining the responsiveness of the local UI. Implementation

[0025] Java native implementation code: / / Handle the same way as goForward() @Override public void goBack() { / / 1. Check if it is a controlled environment tab and the listener status. if (mEnvName != null && !mEnvName.isEmpty() &&Tab.EnvNavigation.getListener() != null) { / / 2. Intercept the native back button logic and send a custom command to the server via a listener. Tab.EnvNavigation.getListener().onGoBack(this); return; } / / 3. In uncontrolled environments, revert to native processing. if (getWebContents() != null) getWebContents().getNavigationController().goBack(); } Server-side invocation method: # 1. Ensure the session is established and obtain the sessionId of the target tab. if tab_info.session_id: ret = await instance.client.send.Target.attachToTarget({"targetId": tab_info.target_id, "flatten": True}) tab_info.session_id = ret.get("sessionId") # 2. Use the Page Domain directive to retrieve the complete history stack of a remote browser. history = await instance.client.send_raw("Page.getNavigationHistory",{}, tab_info.session_id) current_index = history.get("currentIndex", 0) entries = history.get("entries", []) # 3. Calculate the entryId based on the operation instructions and jump to the appropriate page. if action == "back" and current_index > 0: target_entry = entries[current_index - 1] await instance.client.send_raw("Page.navigateToHistoryEntry", {"entryId": target_entry["id"]}, tab_info.session_id) elif action == "forward" and current_index < len(entries) - 1: target_entry = entries[current_index + 1] await instance.client.send_raw("Page.navigateToHistoryEntry", {"entryId": target_entry["id"]}, tab_info.session_id) This invention relates to navigation command redirection: by rewriting the native goBack / goForward interface, a seamless switch from "physical operation" to "remote protocol command" is achieved at the kernel entry level.

[0026] This invention provides precise control based on Session: by introducing a binding mechanism between the page_enabled status bit and sessionId, it solves the problem of locating concurrent commands in the CDP control process.

[0027] This invention features a history index backtracking mechanism: it dynamically calculates the jump point using Page.getNavigationHistory, rather than a simple URL redirect, thus preserving the context state of the remote browser to the greatest extent possible.

[0028] Example 1 like Figure 1As shown, this embodiment provides a remote browser navigation control method, including: The client responds to the user's forward or back action and determines whether the current tab is in a remote isolation environment; If the current tab is in a remote isolation environment, the client intercepts the native navigation command and sends a navigation request to the server through a communication protocol; the navigation request includes at least the operation type and tab identifier, and the operation type is either a forward operation or a back operation; The server receives the navigation request, locates the corresponding remote browser instance based on the tab identifier, and obtains the real history stack and current index of the remote browser instance through CDP. The server determines the target history entry from the real history stack based on the operation type and the current index, and instructs the remote browser instance to jump to the target history entry via CDP.

[0029] In this embodiment, preferably, determining whether the current tab is in a remote isolation environment specifically includes: Check whether the current tab contains a preset environment identifier and whether a communication connection with the server has been established; When the environment identifier is valid and the communication connection is normal, it is determined that the environment is in a remote isolation environment; otherwise, the client's native navigation controller performs the forward or backward operation.

[0030] In this embodiment, preferably, before obtaining the real history stack and current index of the remote browser instance via CDP, the method further includes: The server checks whether a CDP session has been established for the remote browser instance. If not established, the server binds to the remote browser instance using the CDP's Target.attachToTarget directive and obtains the corresponding sessionId; The server associates and stores the sessionId with the tab identifier, and all subsequent CDP commands for that tab carry the sessionId. The server simultaneously manages multiple remote browser instances corresponding to multiple client tabs; each remote browser instance has an independent sessionId, and CDP instructions corresponding to different sessionIds are executed concurrently on the server without interfering with each other.

[0031] In this embodiment, preferably, obtaining the real historical stack and current index of the remote browser instance through CDP specifically includes: The server calls the CDP's Page.getNavigationHistory directive to obtain the historical entry list and current index value of the remote browser instance; each historical entry in the historical entry list contains an entry ID and a URL; The server determines the target historical entry from the real history stack based on the operation type and the current index, specifically including: Let the current index value be N, the historical entry list be E, the entries in the historical entry list be arranged in order starting from index 0, and the total length of the historical entry list be L; If the operation type is back and N is greater than 0, then E[N-1] is selected as the target history entry; If the operation type is forward and N is less than L-1, then E[N+1] is selected as the target history entry; If the operation type is back and N equals 0, or the operation type is forward and N equals L-1, then the server returns a message to the client indicating that there is no history record.

[0032] In this embodiment, preferably, the step of instructing the remote browser instance to jump to the target history entry via CDP specifically includes: The server calls the Page.navigateToHistoryEntry directive of CDP, and carries the entry ID of the target history entry in the parameters of the directive, so that the remote browser instance directly jumps to the page state corresponding to the history entry.

[0033] In this embodiment, preferably, an anomaly handling step is also included: When the communication connection between the client and the server is interrupted, the client disables forward and backward operations and outputs a network error message. When a timeout or error occurs when the server retrieves the historical stack or performs a jump via CDP, the server returns an error code to the client, and the client executes the corresponding degradation strategy based on the error code. The degradation strategy includes any one or more of the following: disabling the forward and back buttons for a preset duration, displaying a prompt message to refresh the page, or switching to the native navigation controller of the client to perform forward or back operations; the preset duration is 3 seconds.

[0034] In this embodiment, preferably, the client manages at least two tabs simultaneously, including a first tab in a remote isolation environment and a second tab not in a remote isolation environment; The client performs interception and remote navigation steps for forward or backward operations on the first tab, while forward or backward operations on the second tab are handled by the client's native navigation controller. The first tab and the second tab maintain a consistent user interface.

[0035] Based on the same inventive concept, this application also provides an apparatus corresponding to the method in Embodiment 1, as detailed in Embodiment 2.

[0036] Example 2 like Figure 2 As shown, this embodiment provides a remote browser navigation control device, including: The response module allows the client to respond to the user's forward or back actions and determine whether the current tab is in a remote isolation environment. If the current tab is in a remote isolation environment, the interception module intercepts the native navigation instructions and sends a navigation request to the server via a communication protocol. The navigation request includes at least an operation type and a tab identifier, where the operation type is either a forward operation or a back operation. The information acquisition module receives the navigation request, locates the corresponding remote browser instance based on the tab identifier, and obtains the real history stack and current index of the remote browser instance through CDP. The operation module, the server determines the target history entry from the real history stack according to the operation type and the current index, and instructs the remote browser instance to jump to the target history entry through CDP.

[0037] In this embodiment, preferably, determining whether the current tab is in a remote isolation environment specifically includes: Check whether the current tab contains a preset environment identifier and whether a communication connection with the server has been established; When the environment identifier is valid and the communication connection is normal, it is determined that the environment is in a remote isolation environment; otherwise, the client's native navigation controller performs the forward or backward operation.

[0038] In this embodiment, preferably, before obtaining the real history stack and current index of the remote browser instance via CDP, the method further includes: The server checks whether a CDP session has been established for the remote browser instance. If not established, the server binds to the remote browser instance using the CDP's Target.attachToTarget directive and obtains the corresponding sessionId; The server associates and stores the sessionId with the tab identifier, and all subsequent CDP commands for that tab carry the sessionId. The server simultaneously manages multiple remote browser instances corresponding to multiple client tabs; each remote browser instance has an independent sessionId, and CDP instructions corresponding to different sessionIds are executed concurrently on the server without interfering with each other.

[0039] In this embodiment, preferably, obtaining the real historical stack and current index of the remote browser instance through CDP specifically includes: The server calls the CDP's Page.getNavigationHistory directive to obtain the historical entry list and current index value of the remote browser instance; each historical entry in the historical entry list contains an entry ID and a URL; The server determines the target historical entry from the real history stack based on the operation type and the current index, specifically including: Let the current index value be N, the historical entry list be E, the entries in the historical entry list be arranged in order starting from index 0, and the total length of the historical entry list be L; If the operation type is back and N is greater than 0, then E[N-1] is selected as the target history entry; If the operation type is forward and N is less than L-1, then E[N+1] is selected as the target history entry; If the operation type is back and N equals 0, or the operation type is forward and N equals L-1, then the server returns a message to the client indicating that there is no history record.

[0040] In this embodiment, preferably, the step of instructing the remote browser instance to jump to the target history entry via CDP specifically includes: The server calls the Page.navigateToHistoryEntry directive of CDP, and carries the entry ID of the target history entry in the parameters of the directive, so that the remote browser instance directly jumps to the page state corresponding to the history entry.

[0041] In this embodiment, preferably, an exception handling module is also included: When the communication connection between the client and the server is interrupted, the client disables forward and backward operations and outputs a network error message. When a timeout or error occurs when the server retrieves the historical stack or performs a jump via CDP, the server returns an error code to the client, and the client executes the corresponding degradation strategy based on the error code. The degradation strategy includes any one or more of the following: disabling the forward and back buttons for a preset duration, displaying a prompt message to refresh the page, or switching to the native navigation controller of the client to perform forward or back operations; the preset duration is 3 seconds.

[0042] In this embodiment, preferably, the client manages at least two tabs simultaneously, including a first tab in a remote isolation environment and a second tab not in a remote isolation environment; The client performs interception and remote navigation steps for forward or backward operations on the first tab, while forward or backward operations on the second tab are handled by the client's native navigation controller. The first tab and the second tab maintain a consistent user interface.

[0043] Since the apparatus described in Embodiment 2 of the present invention is an apparatus used to implement the method of Embodiment 1 of the present invention, those skilled in the art can understand the specific structure and variations of the apparatus based on the method described in Embodiment 1 of the present invention, and therefore will not be described again here. All apparatuses used in the method of Embodiment 1 of the present invention fall within the scope of protection of the present invention.

[0044] Based on the same inventive concept, this application provides an electronic device embodiment corresponding to Embodiment 1, as detailed in Embodiment 3.

[0045] Example 3 This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it can implement any of the implementation methods in Embodiment 1.

[0046] Since the electronic device described in this embodiment is the device used to implement the method in Embodiment 1 of this application, those skilled in the art can understand the specific implementation method and various variations of the electronic device in this embodiment based on the method described in Embodiment 1 of this application. Therefore, how the electronic device implements the method in the embodiment of this application will not be described in detail here. Any device used by those skilled in the art to implement the method in the embodiment of this application falls within the scope of protection of this application.

[0047] Based on the same inventive concept, this application provides a storage medium corresponding to Embodiment 1, as detailed in Embodiment 4.

[0048] Example 4 This embodiment provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it can implement any of the implementation methods in Embodiment 1.

[0049] Example 5 This embodiment describes a remote browser navigation control method, applied to client scenarios that simultaneously include normal environments and remotely isolated environments.

[0050] Suppose a user has opened a tab in a remote, isolated environment on their client machine; let's call this tab tab A. The user clicks three hyperlinks in tab A, visiting page one, page two, and page three in sequence. Now, the user clicks the back button on the client interface, hoping to return to page two.

[0051] In response to the user clicking the back button, the client first executes the back method for tab A. This method first checks whether tab A contains a preset environment identifier and whether a communication connection with the server has been established. In this embodiment, tab A contains a valid environment identifier, and the WebSocket connection between the client and the server is in a normal state; therefore, the client determines that tab A is in a remote isolated environment.

[0052] The client then intercepts the native back instruction and constructs a navigation request message in JSON format. This message includes a message ID, an operation type, and a tab identifier, where the operation type is set to back and the tab identifier is set to a unique identifier for tab A on the client's local machine. The client then sends this navigation request to the server via a WebSocket connection.

[0053] Upon receiving a navigation request, the server first searches its local registry for the corresponding remote browser instance information based on the tab identifier. The server's registry pre-stores a mapping between client tab identifiers and the remote browser instance's `targetId`. If the search is successful, the server further checks whether a CDP session has been established for the remote browser instance. If not, the server binds to the remote browser instance using the CDP's `Target.attachToTarget` directive, obtains a unique `sessionId`, and associates and stores this `sessionId` with the client tab identifier.

[0054] After obtaining the sessionId, the server calls the CDP's Page.getNavigationHistory directive, carrying the sessionId, to retrieve the real history stack of the remote browser instance. This directive returns a list of history entries and a current index value. Each history entry in the list contains an entry ID and a URL, and the entries are arranged sequentially from 0 according to the access order. In this embodiment, the user accessed page 1, page 2, and page 3 in sequence, so the history entry list contains three entries, with the entry index for page 1 being 0, the entry index for page 2 being 1, and the entry index for page 3 being 2. The current index value is 2, indicating that page 3 is currently being displayed.

[0055] Since the operation type is a back operation and the current index value 2 is greater than 0, the server selects the entry with index 1 in the historical entry list, that is, the historical entry corresponding to page 2, as the target historical entry.

[0056] The server then invokes the CDP's `Page.navigateToHistoryEntry` directive, carrying the target history entry's entry ID and the previously obtained `sessionId` as parameters, instructing the remote browser instance to navigate to that history entry. Upon receiving the directive, the remote browser instance directly loads the complete page state corresponding to that history entry, including page content, form data, scroll position, etc., without needing to initiate a new HTTP request.

[0057] After a successful redirect, the server returns a success response message to the client via WebSocket. This message may include the URL and title information of the target page. Upon receiving the response, the client updates the address bar and title bar on its interface, completing the back operation. The entire process is seamless for the user, and the user experiences the same back operation as in a regular browser.

[0058] If the user clicks the back button again, the current index value becomes 1. The server executes the above process again, selecting the historical entry with index 0, i.e., page one, as the target historical entry, and instructs the remote browser instance to jump. When the user clicks the back button again, the current index value is now 0, and the back condition is not met. The server returns a message to the client indicating that there is no history record. Upon receiving this message, the client can either ignore the operation or inform the user through a prompt that the starting point of the history has been reached.

[0059] Similarly, when a user clicks the forward button, the client sends a navigation request with the operation type "forward". The server checks if the current index value is less than the total length of the historical entry list minus one. If so, it selects the historical entry corresponding to the current index value plus one as the target historical entry and performs the jump.

[0060] The following describes the implementation method in a multi-window concurrent scenario, with a focus on the isolation mechanism of sessionId.

[0061] Suppose a user has two remote isolated environment tabs open simultaneously on the client, denoted as tab B and tab C. Tab B currently displays page B2, and its history stack includes pages B1 and B2; tab C currently displays page C3, and its history stack includes pages C1, C2, and C3.

[0062] The server's registry stores the mapping information for tab B and tab C, including their respective targetId and sessionId. The sessionId for tab B is denoted as sessionId_B, and the sessionId for tab C is denoted as sessionId_C; the two sessionIds are distinct.

[0063] The user first clicks the back button on tab B. The client sends a navigation request to the server carrying the identifier of tab B. The server finds sessionId_B based on the tab B identifier and includes this sessionId when invoking CDP commands. Therefore, the commands only apply to the remote browser instance corresponding to tab B. The server retrieves the history stack of tab B, whose current index value is 1. The back operation will then redirect to page B1 with index 0.

[0064] Almost simultaneously, the user clicks the back button on tab C, and the client sends a navigation request carrying the identifier of tab C to the server. The server finds sessionId_C based on the tab C identifier, and includes this sessionId when invoking CDP commands. These commands only apply to the remote browser instance corresponding to tab C. The server retrieves the history stack of tab C, whose current index is 2. The back operation will then redirect to page C2 with index 1.

[0065] Because the two operations use different sessionIds, the server can execute these two CDP commands concurrently, and the two remote browser instances can independently complete the redirection without interfering with each other. User actions in different tabs receive correct responses, and there are no issues with command crosstalk or page errors.

[0066] The following describes the handling process under abnormal conditions, including two scenarios: communication interruption and CDP instruction execution failure.

[0067] In a communication interruption scenario, suppose the WebSocket connection between the client and server is broken due to a network failure. When the user clicks the back button, the client first checks the tab's context identifier and the communication connection status. Although the context identifier is valid, the communication connection status is broken, therefore the client cannot send the navigation request to the server.

[0068] The client executes pre-defined exception handling logic: It disables the forward and back buttons on the current tab, making them grayed out and unclickable. Simultaneously, a brief notification pops up at the top of the screen informing the user of a network connection error and requesting them to check their network and try again. The client also initiates a reconnection mechanism, attempting to re-establish the WebSocket connection at increasingly frequent intervals. Upon successful reconnection, the client restores the clickable forward and back buttons, allowing the user to continue using the service normally.

[0069] In scenarios where CDP directives fail to execute, assuming the server has received the client's navigation request and successfully obtained the sessionId, but a timeout occurs when calling the Page.getNavigationHistory directive, the reason may be that the remote browser instance is unresponsive.

[0070] The server catches the timeout exception and constructs an error response message based on the exception type. This message includes the corresponding message ID, an error status, and a predefined error code, such as CDP_TIMEOUT. The server then returns this error response to the client via WebSocket.

[0071] Upon receiving an error response, the client parses the error code and executes the corresponding degradation strategy. In this embodiment, for the CDP_TIMEOUT error code, the client adopts the following degradation strategy: disabling the forward and back buttons for a preset duration of three seconds; simultaneously outputting a page refresh prompt, suggesting the user refresh and try again. After three seconds, the client restores the buttons to clickable status, allowing the user to try the back operation again.

[0072] If the error code received by the client is of another type, such as TAB_NOT_FOUND indicating that the tab is not registered on the server, the client will execute another fallback strategy: switch to the client's native navigation controller to perform forward or backward operations and log the results for later analysis.

[0073] The following describes a hybrid implementation where the client manages both regular environment tabs and remote isolated environment tabs simultaneously.

[0074] Assume two tabs are open simultaneously on the client. Tab D is the normal environment tab, whose page is directly rendered and navigated by the client's local kernel; tab E is the remote isolation environment tab, whose page is rendered by a remote browser instance on the server and displayed on the client via screen transmission.

[0075] The client maintains an environment identifier field for each tab. The environment identifier for tab D is empty or a preset non-remote identifier value, while the environment identifier for tab E is a specific value indicating a remote isolation environment.

[0076] When a user clicks the back button in tab D, the client executes the back method of tab D. This method checks the environment identifier and finds that tab D is not in a remote isolated environment. Therefore, it does not execute the interception logic, but directly calls the goBack method of the navigation controller in the client's local kernel. The local kernel performs the back operation based on its own maintained history stack and loads the content of the previous page.

[0077] When a user clicks the back button in tab E, the client executes the back method of tab E. This method checks the environment identifier and finds that tab E is in a remote isolated environment and the communication connection is normal. Therefore, it executes the interception logic and sends a navigation request to the server according to the steps described in Example 1. The server then controls the remote browser instance to perform the back operation through CDP instructions.

[0078] Both tab handling methods maintain a consistent user interface; that is, the user's action and visual effect when clicking the back button are completely identical in both tabs. The client automatically selects the correct processing path based on the tab's attributes, so users do not need to understand the current tab's context or learn different operation methods.

[0079] This hybrid model allows the same client application to flexibly adapt to various deployment scenarios. In an enterprise intranet environment, users can simultaneously access external websites that require high security isolation as well as internal websites that do not require isolation, both coexisting harmoniously in the same browser window and each employing the most suitable navigation method.

[0080] The following describes the server-side management process for the lifecycle of a remote browser instance, including the establishment of mappings when a tab is created and the release of resources when a tab is closed.

[0081] When a client needs to create a new tab for a remote, isolated environment, it first sends a tab creation request to the server. Upon receiving the request, the server either starts a new remote browser instance or creates a new tab context within an existing browser process. The server then obtains the targetId of the remote browser instance or tab and returns it to the client.

[0082] After receiving the targetId, the client generates a locally unique tab identifier, associates this tab identifier with the targetId, and stores it. Simultaneously, it sets the environment identifier to a remote, isolated environment. The client sends this mapping relationship to the server via a registration message. The server stores the correspondence between the client's tab identifier and the targetId in the registry. At this point, the tab is registered, but the server has not yet established a CDP session for this tab. The session will be established on demand during the first navigation operation to conserve resources.

[0083] When a user closes the tab, the client executes the tab's close method. The client first sends a close tab message to the server via WebSocket, carrying the client's tab identifier. Upon receiving the message, the server searches the registry for the corresponding information based on the tab identifier. If a corresponding sessionId exists, the server can optionally call the CDP's Target.detachFromTarget directive to release session resources. Subsequently, the server deletes the tab's mapping record from the registry and can choose to close the corresponding remote browser instance or mark it as idle for reuse.

[0084] After sending a close message, the client cleans up locally stored resources such as targetId, sessionId, and tab identifiers. This lifecycle management ensures effective reclamation of server resources, preventing memory leaks and session remnants.

[0085] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0086] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1A device that provides the functions specified in one or more boxes.

[0087] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0088] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0089] While specific embodiments of the present invention have been described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and not intended to limit the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A remote browser navigation control method, characterized in that, include: The client responds to the user's forward or back action and determines whether the current tab is in a remote isolation environment; If the current tab is in a remote isolation environment, the client intercepts the native navigation command and sends a navigation request to the server through a communication protocol; the navigation request includes at least the operation type and tab identifier, and the operation type is either a forward operation or a back operation; The server receives the navigation request, locates the corresponding remote browser instance based on the tab identifier, and obtains the real history stack and current index of the remote browser instance through CDP. The server determines the target history entry from the real history stack based on the operation type and the current index, and instructs the remote browser instance to jump to the target history entry via CDP.

2. The method according to claim 1, characterized in that, The determination of whether the current tab is in a remote isolation environment specifically includes: Check whether the current tab contains a preset environment identifier and whether a communication connection with the server has been established; When the environment identifier is valid and the communication connection is normal, it is determined that the environment is in a remote isolation environment; otherwise, the client's native navigation controller performs the forward or backward operation.

3. The method according to claim 1, characterized in that, Before obtaining the real history stack and current index of the remote browser instance via CDP, the process also includes: The server checks whether a CDP session has been established for the remote browser instance. If not established, the server binds to the remote browser instance using the CDP's Target.attachToTarget directive and obtains the corresponding sessionId; The server associates and stores the sessionId with the tab identifier, and all subsequent CDP commands for that tab carry the sessionId. The server simultaneously manages multiple remote browser instances corresponding to multiple client tabs; each remote browser instance has an independent sessionId, and CDP instructions corresponding to different sessionIds are executed concurrently on the server without interfering with each other.

4. The method according to claim 1, characterized in that, The step of obtaining the real history stack and current index of the remote browser instance through CDP specifically includes: The server calls the CDP's Page.getNavigationHistory directive to obtain the historical entry list and current index value of the remote browser instance; each historical entry in the historical entry list contains an entry ID and a URL; The server determines the target historical entry from the real history stack based on the operation type and the current index, specifically including: Let the current index value be N, the historical entry list be E, the entries in the historical entry list be arranged in order starting from index 0, and the total length of the historical entry list be L; If the operation type is back and N is greater than 0, then E[N-1] is selected as the target history entry; If the operation type is forward and N is less than L-1, then E[N+1] is selected as the target history entry; If the operation type is back and N equals 0, or the operation type is forward and N equals L-1, then the server returns a message to the client indicating that there is no history record.

5. The method according to claim 4, characterized in that, The step of instructing the remote browser instance to jump to the target history entry via CDP specifically includes: The server calls the Page.navigateToHistoryEntry directive of CDP, and carries the entry ID of the target history entry in the parameters of the directive, so that the remote browser instance directly jumps to the page state corresponding to the history entry.

6. The method according to claim 1, characterized in that, It also includes exception handling steps: When the communication connection between the client and the server is interrupted, the client disables forward and backward operations and outputs a network error message. When a timeout or error occurs when the server retrieves the historical stack or performs a jump via CDP, the server returns an error code to the client, and the client executes the corresponding degradation strategy based on the error code. The degradation strategy includes any one or more of the following: disabling the forward and back buttons for a preset duration, displaying a prompt message to refresh the page, or switching to the native navigation controller of the client to perform forward or back operations; the preset duration is 3 seconds.

7. The method according to claim 1, characterized in that, The client manages at least two tabs simultaneously, including a first tab that is in a remote isolation environment and a second tab that is not in a remote isolation environment; The client performs the interception and remote navigation steps as described in claim 1 for the forward or backward operation of the first tab, while the forward or backward operation of the second tab is handled by the client's native navigation controller; The first tab and the second tab maintain a consistent user interface.

8. A remote browser navigation control device, characterized in that, include: The response module allows the client to respond to the user's forward or back actions and determine whether the current tab is in a remote isolation environment. If the current tab is in a remote isolation environment, the interception module intercepts the native navigation instructions and sends a navigation request to the server via a communication protocol. The navigation request includes at least an operation type and a tab identifier, where the operation type is either a forward operation or a back operation. The information acquisition module receives the navigation request, locates the corresponding remote browser instance based on the tab identifier, and obtains the real history stack and current index of the remote browser instance through CDP. The operation module, the server determines the target history entry from the real history stack according to the operation type and the current index, and instructs the remote browser instance to jump to the target history entry through CDP.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 7.