What are native functions

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

Canvas apps include a Javascript API built into their source code, allowing your website to trigger certain in-app actions using Javascript functions.

The Native Functions are not available for use until your page is fully loaded within the app, for that reason when a page loads in the app we trigger an event, which tells us that the Javascript API is ready to be used. You will want to listen to that event to make sure the functions are called at the right time, preventing errors in your application.

Here you can see an example of how to listen to the event triggered by the app:

<script type="text/javascript">
    // Listen to events
    window.addEventListener("message", (event) => {
    }, false);

    // Function that runs when the event is triggered
    function runNativeFunctions(event) {
        try {

            // Check if the native functions are ready to be used
            if (event.data && event.data == 'nativeFunctionsLoaded') {
                // Native function can be called here

        } catch (ex) {
            // Log any error messages for easier debugging

We have also prepared a sample page that can be used in your app for testing the native functions, or if you prefer, you can copy its code and add it to your website directly, you can find the page here: https://mobiloudsupport.github.io/nativefunctions/

Below you can find a list of all the available native functions in the Canvas platform:

nativeFunctions.onesignalSendTags("1", "2");
nativeFunctions.onesignalDeleteTags("1", "2");
nativeFunctions.onesignalRemoveExternalUserId("user ID");
nativeFunctions.onesignalSetExternalUserId("user ID");

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.