Custom JavaScript

In-App Custom JavaScript

📘

Enter Custom JavaScript to be injected onto your website pages when they are displayed through your app. For instance, you may find it more convenient to specify JavaScript Bridge commands here rather than adding this code on your website itself. JavaScript added in the top section is injected in both iOS and Android apps or use the platform-specific sections if only needed for one of your apps. Format the JavaScript similar to an external .js file without any HTML or <script> tags.

Example: Send Device Info on your login page

if(location.pathname.startsWith('/login'){
  gonative.deviceInfo().then(function (deviceInfo) {
    fetch('https://yourwebsite.com/api/registration', {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify(deviceInfo),
    });
  });
}