In the code on the right, you can see that we import the
Browser class from the
remote-browser package, instantiate a new class instance, and then wait for
browser.launch() to resolve.
When we call
browser.launch(), the Remote Browser client connects to one of our servers, launches an instance of Firefox with the Remote Browser Web Extension installed, and then bridges the connection between the client and the extension using WebSockets.
Later on, we call
browser.quit() to shutdown the remote Firefox instance and clean up the connection.
In between launching and quitting our remote browser instance, we navigate the current tab of the remote browser to the Intoli Blog by calling
What might be surprising here is that
browser.tabs.update() isn't actually part of Remote Browser's API!
In fact, the Remote Browser API doesn't even include a method for navigating to a new URL.
The browser.tabs.update() method is actually part of the Web Extensions API, as is the browser.tabs.Tab object that it returns.
Any of the Web Extension API's methods which are exposed via the
browser object in an extension can be called directly using an instance of Remote Browser's
Browser control class.
Even if you're controlling a browser that uses the older callback-based
chrome API object, the
browser object is automatically polyfilled so that you can use the newer promise-based
This means that Remote Browser doesn't have to implement its own methods for things like navigating, taking screenshots, modifying cookies, or intercepting request headers.
The Web Extensions API already offers all of this functionality, and Remote Browser simply makes it really easy to interact with this extremely powerful API.
In fact, the name "Remote Browser" is actually meant to reflect the idea of having remote access to the Web Extension API's