@remotehq/remote-browser-sdk
v1.4.0
Published
The official JavaScript library for embedding and controlling Remote Browser from RemoteHQ
Downloads
14
Readme
@remotehq/remote-browser-sdk
The official JavaScript/TypeScript client SDK for embedding and controlling Remote Browser by RemoteHQ.
Installation
# via npm
npm install --save @remotehq/remote-browser-sdk
# via yarn
yarn add @remotehq/remote-browser-sdk
Usage example
import * as remoteBrowserSdk from "@remotehq/remote-browser-sdk";
// 1. Get instanceURN via API call
const instanceURN = "..."; // received from the API
// 2. Create new client instance
const rbClient = remoteBrowserSdk.createClient({
instanceURN,
iframeSource: "rhq", // unique value per customer
role: "...", // unique value representing a role (returned via API when creating new instance)
userName: "Jon",
allowFullscreen: true,
disableAudio: false,
logoUrl: "...", // customize the experience by changing default logo to your own
targetOrigin: "https://rooms.remotehq.com", // If we setup a custom domain for you - you'll need to change this value
barLocation: "top-right" // or 'top-left', determines location of the top navigation
});
// 3. Attach to DOM
rbClient.attach("#remote-browser-container"); // Selector or Element
// 4. Enjoy external API to control the Remote Browser
rbClient.openInCurrentTab("https://weather.com");
rbClient.openInNewTab("https://weather.com");
// 5. Listen for extra messages
function onError (error) { ... }
this.rbClient.on('openInCurrentTab:error', onError);
this.rbClient.off('openInCurrentTab:error', onError);
// 6. Destroy when not using anymore
rbClient.destroy();
Documentation
For full documentation, visit the official RemoteHQ documentation.