Skip to main content

Browser events

If the Topper browser session is opened using JavaScript — for example by using — then you can receive updates on the user's session by using the postMessage API.

// Generate a bootstrap token.
const bootstrapToken = await generateBootstrapToken();

// Open a Topper window using the bootstrap token.
const topperWindow =`${bootstrapToken}`);

// Add event listeners
topperWindow.addEventListener('message', (event) => {
// Ignore messages that didn't originate from Topper.
if (event.origin !== '') {

// Log the message data.

Browser events have not yet been implemented, but will be available soon. We will release a JavaScript SDK to make it easier to open a Topper browser session and listen to events.