Browser
The Browser module allows manipulation of browser instances.
Holes
Sometimes you need to open holes in the graphics layer so that video can be seen behind it. This feature is often necesary because video and graphics are processed in different hardware layers and can not mix. (Contrast this with how the HTML5 < video > tag works, which lets you mix graphics and video.)
Tab Controller
A tab controller API has been made available within the new solidBrowser NFBE engine. This API allows users to create, show, and close browser tabs, as well as retrieve information about them. Browser tab information is encapsulated in a TabInfo object and contains the following properties:
- id - The unique tab identifier
- url - The tab URL
- state - The tab state (0=Initializing, 1=Created, 2=Loading, 3=Ready, 4=Error)
- visible - The tab visibility status (0=hidden, 1=shown)
- acceptedKeys - The input key codes that the tab accepts and handles when it is hidden
Call the createTab function to create a new browser tab. Call the showTab function to show a specific browser tab and hide the others. Call the closeTab function to close a specific browser tab. Call the setTabURL function to change the URL of a specific browser tab. Call the getCurrentTab function to get information about the current browser tab. Call the getTab function to get information about a specific browser tab. Call the getAllTabs function to get information about all open browser tabs. Call the getAcceptedKeys function to get the list of input key codes that a specific browser tab accepts and handles when it is hidden. Call the getAcceptedKeys function to set the list of input key codes that a specific browser tab accepts and handles when it is hidden.
Methods
closeTab(id)
Close the specified browser tab. The behaviour of the browser after the tab is closed varies as follows:
- The specified tab is the only one in the browser: The browser app will be terminated.
- The specified tab is the last one in the browser: The immediately previous tab will be shown.
- All other cases: The immediately next tab will be shown.
Parameters:
| Name | Type | Description |
|---|---|---|
id | String | The unique identifier of the browser tab to be closed. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
createTab(id, url)
Create a new browser tab with the given id and URL.
Parameters:
| Name | Type | Description |
|---|---|---|
id | String | The unique identifier of the new browser tab. |
url | String | The URL to be loaded by the new browser tab. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
getAcceptedKeys(id)
Get the input key codes that the specified browser tab accepts and handles when it is hidden.
Parameters:
| Name | Type | Description |
|---|---|---|
id | String | The unique identifier of the browser tab. |
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - keys: An array of integer values corresponding to the accepted input key codes. |
getAllTabs()
Get info about all currently open browser tabs.
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - tabinfos: An array of TabInfo objects corresponding to the currently open browser tabs. |
getCurrentTab()
Get info about the currently visible browser tab.
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - tabinfo: A TabInfo object corresponding to the currently visible browser tab. |
getTab(id)
Get info about the specified browser tab.
Parameters:
| Name | Type | Description |
|---|---|---|
id | String | The unique identifier of the browser tab. |
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - tabinfo: A TabInfo object corresponding to the specified browser tab. |
setAcceptedKeys(id, keys)
Set the input key codes that the specified browser tab accepts and handles when it is hidden.
Parameters:
| Name | Type | Description |
|---|---|---|
id | String | The unique identifier of the browser tab. |
keys | Array | The array of accepted input key codes. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
setTabURL(id, url)
Load the specified URL in the specified browser tab. This function can be called even if the specified browser tab is not currently visible.
Parameters:
| Name | Type | Description |
|---|---|---|
id | String | The unique identifier of the browser tab. |
url | String | The URL to be loaded by the specified browser tab. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
showTab(id)
Show the specified browser tab and hide all the others.
Parameters:
| Name | Type | Description |
|---|---|---|
id | String | The unique identifier of the browser tab to be shown. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |