Browser
There are several use-cases when you need to open a web browser on a touch-enabled device (also known as a tablet). For these cases, you can use a custom web browser we built. Default URL can be opened and even the whitelisting/blacklisting of certain domains is supported.
All methods
Methods | Description | Supported since |
---|---|---|
open() | Open page in integrated browser | 4.0.0 |
close() | Open page in integrated browser | 4.4.0 |
open()
This API is currently available on:
- Android devices with Android 5+ (Philips, Benq, Sharp, generic Android device)
With some limitation you can use this API also on
- Samsung Tizen (SSSP 4 and above); where the website is just in fullscreen without an address bar or theme options (headless mode)
- LG webOS (webOS 3.0 and above); where the website is just in fullscreen without an address bar or theme options (headless mode)
- Linux (Fedora, Ubuntu), Raspberry Pi, NEC Compute Module; where the website is just in fullscreen without an address bar or theme options (headless mode)
- BrightSign; where the website is just in fullscreen without an address bar or theme options (headless mode)
Javascript
Simple opening some page ex. our main company page.
sos.browser.open('https://www.signageos.io'); // Open link in the browser
Method open()
also supports properties for browser, all of which are optional.
Property | Type | Description |
---|---|---|
aclDomains | Array | List of domains to be interpreted according to aclMode . Example: signageos.io , www.example.com |
aclMode | String |
|
readOnlyAddressBar | Boolean |
|
coordinates | Object | Size and position of the browser window. Defaults to fullscreen. (Android, Linux) |
idleTimeout | Number | The browser will automatically close after a specified period of inactivity (in milliseconds). |
theme | Object | Specify custom UI theme. (Android) |
headlessMode | Boolean | Headless mode hides the entire address bar (default) |
canUserClose | Boolean | Whether the user can manually close the browser. Default: Headless: false With UI: true |
clearData | Boolean | Clear cache after the browser closes. Default: Headless: false With UI: true |
method | String | Can only be native (which opens a new, fully sandboxed fullscreen window) or iframe (which opens a configurable-sized window). (only Linux) |
sos.browser.open('https://www.signageos.io', {
aclDomains: ['google.com', 'yahoo.com'],
aclMode: 'blacklist', // or 'whitelist'
readOnlyAddressBar: true,
coordinates: { // Supported only on Linux and Android
x: 0,
y: 0,
height: 500,
width: 500,
},
// theme: { ... } // supported only on Android
headlessMode: false, // supported only on Android
});
Browser themes usage with Typescript
You can also use all these methods with signageOS TypeScript.
Browser themes are only available on Android devices.
type Color = string;
export type ITheme = {
base?: 'light' | 'dark'; // Default light
shape?: {
cornerSize?: number; // Default 2
};
colors?: {
primary?: Color;
background?: Color;
control?: Color;
};
widgets?: {
editAddress?: {
colors?: {
background?: Color;
text?: Color;
};
};
buttonClose?: {
colors?: {
background?: Color | '@primary';
text?: Color;
icon?: Color;
};
icon?: 'none' | 'exit_to_app' | 'close' | 'cancel';
text?: string;
};
progress?: {
color?: Color | '@primary';
};
};
};
interface IOpenLinkOptions {
aclDomains?: string[];
aclMode?: 'blacklist' | 'whitelist';
readOnlyAddressBar?: boolean;
coordinates?: {
x: number;
y: number;
width: number;
height: number;
};
theme?: ITheme;
headlessMode?: boolean;
clearData?: boolean;
canUserClose?: boolean;
method?: 'native' | 'iframe'
}
open(uri: string, options?: IOpenLinkOptions): void;
close()
Closing the Browser instance. The whole page is closed. If you call open()
again, the page will be loaded from the beginning.
Javascript
Simple opening some page ex. our main company page.
sos.browser.close(); // Close the browser
Errors
Although we are doing our best, following errors may occur when opening a link.
Code | Type | Message |
---|---|---|
40301 | AppletBrowserUriError | Property argument uri must be a string |
50301 | InternalBrowserOpenLinkError | Unexpected error occurred when opening $$LINK$$ |