Active session controls
Cobrowse active session controls. You can fully customize the interface for a Cobrowse session, including how to end a session.
CobrowseIO.showSessionControls = function() {
// your code, i.e. $('#cobrowse-control').show() or similar
}
CobrowseIO.hideSessionControls = function() {
// your code, i.e. $('#cobrowse-control').hide() or similar
}func cobrowseShowSessionControls(_ session: CBIOSession) {
// You can render controls however you like here.
}
func cobrowseHideSessionControls(_ session: CBIOSession) {
// hide your session controls
}- (void)cobrowseShowSessionControls:(CBIOSession*) session {
// You can render controls however you like here.
}
- (void)cobrowseHideSessionControls:(CBIOSession*) session {
// hide your session controls
}Programmatically ending the current session
if (CobrowseIO.currentSession)
await CobrowseIO.currentSession.end();[CobrowseIO.instance.currentSession end:^(NSError * _Nullable err, CBIOSession * _Nullable session) {
// handle errors here
}];if (CobrowseIO.instance().currentSession() != null ) {
CobrowseIO.instance().currentSession().end((err, session) -> {
// handle errors here
});
}// Get a reference to the current session if you don't have one
const session = await CobrowseIO.currentSession();
// if there's an ongoing session, end it
if (session) await session.end()// Get a reference to the current session if you don't have one
Session? session = await CobrowseIO.instance.currentSession();
// if there's an ongoing session, end it
if (session != null) {
await session.end()
}CobrowseIO.Instance().CurrentSession?.End(null);Example UIs
<script>
CobrowseIO.client().then(function() {
var button = document.createElement('div');
button.className = '__cbio_ignored';
button.textContent = 'End';
button.style.fontFamily = 'sans-serif';
button.style.padding = '10px 13px';
button.style.fontSize = '13px';
button.style.color = 'white';
button.style.boxShadow = '0px 2px 5px #33333344';
button.style.cursor = 'pointer';
button.style.borderRadius = '30px';
button.style.background = 'blue';
button.style.position = 'fixed';
button.style.zIndex = '2147483647';
button.style.bottom = '20px';
button.style.left = '50%';
button.style.transform = 'translateX(-50%)';
button.addEventListener('click', function() {
if (CobrowseIO.currentSession) CobrowseIO.currentSession.end();
});
CobrowseIO.showSessionControls = function() {
document.body.appendChild(button);
}
CobrowseIO.hideSessionControls = function() {
if (button.parentNode) button.parentNode.removeChild(button);
}
});
</script>Last updated