Name | Description |
---|---|
getId | Returns tab unique identifier |
getUrl | Returns URL for the tab |
getTitle | Returns title for the tab |
isActive | Returns true if the window is in focus now |
navigate | Navigates current tab to new URL |
dispatchMessage | Dispatches a messages to the content script(s) in the tab |
close | Closes tab |
Returns tab unique identifier.
Returns: | tab unique identifier |
---|---|
Return type: | string |
Example:
// output ID for current active tab
kango.browser.tabs.getCurrent(function(tab) {
// tab is KangoBrowserTab object
kango.console.log(tab.getId());
});
Returns URL for tab.
Returns: | tab URL |
---|---|
Return type: | string |
Example:
// output URL for current active tab
kango.browser.tabs.getCurrent(function(tab) {
// tab is KangoBrowserTab object
kango.console.log(tab.getUrl());
});
Returns title for tab.
Returns: | tab title |
---|---|
Return type: | string |
Example:
// output title for current active tab
kango.browser.tabs.getCurrent(function(tab) {
// tab is KangoBrowserTab object
kango.console.log(tab.getTitle());
});
Returns true for active tab and false for not active.
Returns: | true for active tab and false for not active |
---|---|
Return type: | boolean |
Example:
kango.browser.tabs.getCurrent(function(tab) {
// tab is KangoBrowserTab object
kango.console.log('Current tab is active: ' + tab.isActive());
});
Dispatches a message to the content script(s) executing in the tab.
See Messaging API section for more details.
Arguments: |
|
---|
Example:
// This will send a message to current tab content scripts
// In this sample message named 'action' will have two fields data object
// It is possible to use any JSON serializable object
kango.browser.tabs.getCurrent(function(tab) {
// tab is KangoBrowserTab object
tab.dispatchMessage('action', {name: 'DoABarrelRoll', count: 5});
});