Logout with native functions

Turn your website into an app in 60 seconds!
Preview My App
Jack & Jones' desktop website and mobile app.

If your app is configured to require users to log in before they can access the content, and you are already using the nativeFunctions.login() to log users in, you will want to implement the nativeFunctions.logout() function as well.

When triggered, the nativeFunctions.logout() will clear all cookies and sessions in the app, and reload the app, taking the user back to the login screen.

Imagine a situation where while browsing your app the user gets logged out because his cookies expired, if the nativeFunctions.logout() function is not triggered the user will see your website’s error messages for blocked content, and the user experience might get confusing for the user.

Instead, you should take the user to the login screen so he can provide his credentials and re-login accordingly.

You can call the nativeFunctions.logout() after you have confirmed that the user is not logged in:

// Check if the user is currently logged-in, if not, call the logout function

<script type="text/javascript">
	// Add the event listener
	window.addEventListener("message", (event) => {
		isAppReady = event;
	}, false);

	// Log the user in
	function appLogout(isAppReady) {
		try {
			// Check if the native functions are ready to be used
			if (isAppReady.data && isAppReady.data == 'nativeFunctionsLoaded') {

		} catch (ex) {

Launch your brand's mobile app with a team of experts by your side.

Our team holds your hand through every step of the process to make building an app a no-brainer.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
  • Preview your app yourself or get a live demo on a call.
  • Learn about our platform and process to help you launch with minimal work required.
  • Risk free - 100% app approval guaranteed or your money back.
Only and Bestseller's iOS and Android apps.
Thank you! We'll be in touch within 48 hours :)
Oops! Something went wrong while submitting the form.
Chat icon.