Fullpage App Showing App Not Defined Error

Hi I have created a Full page App but I am getting this error in console

ReferenceError: app is not defined

document.addEventListener("DOMContentLoaded", function () {

var client;

async function init() {
  client = await app.initialized();
  client.events.on('app.activated', renderText);


async function renderText() {

const inputNum = document.getElementById("contactSearch");
inputNum.addEventListener("fwInput", searchCon);


Please help on this
FDK version 8.6.7
Node 14.2

Hello @franklin ,
Looking at the error, I am guessing we may be having some issues with the loading sequence of your files. Ideally we would want the script where we write our app code to be linked in the end or we can add a defer tag to the script to ensure it loads once the DOM is parsed. Can you please share the code of your index.html. It should be something like this.

<!DOCTYPE html>

<html lang="en">
    <title>A Template App</title>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script async src="https://static.freshdev.io/fdk/2.0/assets/fresh_client.js"></script>
    <link rel="stylesheet" type="text/css" href="styles/style.css" />

    <div class="main">
    <script defer src="scripts/app.js"></script>

Note: fdk8 is going to be deprecated by July 31, 2023. I would recommend you to migrate your app to the latest fdk9. Refer migration changes here

Thanks for reply I have added Defer in the script and now its working fine

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.