If you want to add a custom EXIT button to your HTML, do something like this:
<button onclick="closePresentation">
Exit
</button>
function closePresentation() {
if (mobilelocker) {
mobilelocker.closePresentation()
.then(() => {
console.log('Presentation closed successfully')
})
.catch(err => {
console.error('Presentation could not be closed successfully', err.message);
})
.finally(() => {
// @see https://developer.mozilla.org/en-US/docs/Web/API/Window/close
window.close();
})
}
}
The forms-demo project has an example of how this works. Look at the exit()
function.
You can also close the current presentation programmatically:
mobilelocker.closePresentation();
<a href="mobilelocker/api?method=close-presentation">Close presentation</a>