The performance of the Ionic app is significantly hindered by lagging issues both on Google

After starting to work with the ionic framework, I noticed a significant change in performance when testing an android app on Chrome for the first time. It was fast and responsive until I added a button that led to a screen with navigation bars, side menus, and custom fonts on both screens. Suddenly, the app slowed down drastically to the point where clicking the button to navigate became nearly impossible. Surprisingly, the app runs much smoother in Firefox, but even when using 'ionic serve --lab', there is still noticeable lag. Additionally, I experienced issues with loading custom fonts on Android devices - they display correctly upon initial launch, but fail to show up on subsequent launches. Below is the code for both screens:

`<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    <link href="css/ionic.app.css" rel="stylesheet">
    -->

    <!-- your app's js -->
  </head>
  <body ng-app="starter">

    <ion-pane class="customBackground">
          <div class="harpee" style="font-family: Freehand521, sans-serif">Harpee</div>
          <div class="motto">
              <p>A Culture of Happiness and Hope</p>
          </div>
          <div class="logIn">
              <h1>Log In</h1>
          </div>
          <div class="logInForm">
              <div class="list list-inset">
                  <label class="item item-input">
                      <input type="text" placeholder="Username">
                  </label>
              </div>
              <div class="list list-inset formSpacing">
                  <label class="item item-input">
                      <input type="password" placeholder="Password">
                  </label>
              </div>
              <a href="homeView.html">
                <button class="button button-positive customButton">
                  Sign In
                </button>
              </a>
              <div class="customText">
                  <p>Forgot your Password?</p>
                  <p>Sign Up</p>
              </div>
          </div>
    </ion-pane>

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>
    <script src="js/app.js"></script>

  </body>
</html>` 
`<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/home.css" rel="stylesheet">

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    <link href="css/ionic.app.css" rel="stylesheet">
    -->

    <!-- your app's js -->
    <!--Fonts-->
</head>
<body ng-app="starter">

    <ion-pane>
        <ion-side-menus>
            <ion-side-menu-content>
                <ion-nav-bar class="bar bar-header bar-positive">
                    <ion-nav-buttons side="left">
                        <button menu-toggle="left" class="button button-icon icon ion-navicon"></button>
                    </ion-nav-buttons>
                    <ion-nav-buttons side="right">
                        <i class="icon ion-ios7-search button button-clear" ng-click="#"></i>
                    </ion-nav-buttons>
                </ion-nav-bar>

                <ion-tabs class="tabs-positive">
                    <ion-tab icon="ion-home" ui-sref="home">
                        <ion-nav-view name="home"></ion-nav-view>
                    </ion-tab>
                    <ion-tab icon="ion-compose" ui-sref="talk">
                        <ion-nav-view name="talk"></ion-nav-view>
                    </ion-tab>
                    <ion-tab icon="ion-social-reddit" ui-sref="hdi">
                        <ion-nav-view name="hdi"></ion-nav-view>
                    </ion-tab>
                    <ion-tab icon="ion-person" ui-sref="you">
                        <ion-nav-view name="you"></ion-nav-view>
                    </ion-tab>
                </ion-tabs>
          </ion-side-menu-content>
          <ion-side-menu side="left">
              <header class="bar bar-header bar-stable">
                  <h1 class="title">Menu</h1>

              </header>
              <ion-content class="has-header">
                  <ion-list>
                      <ion-item class="item item-avatar">
                          <img src="img/3.jpg">
                          <h2>User Name</h2>
                          <p>Brief Bio</p>
                          <!--This is the actual code to be used, to fetch user data and display as in the above code-->
                          <!--<img ng-src="{{item.img}}">-->
                          <!--<h2>{{item.title}}</h2>-->
                          <!--<p>{{item.description}}</p>-->
                      </ion-item>
                      <ion-item nav-clear menu-close ng-click="#">
                          <i class="icon ion-person" ng-click="#">
                              My Profile
                          </i>
                      </ion-item>
                      <ion-item nav-clear menu-close ng-click="#">
                          <i class="icon ion-person-stalker" ng-click="#">
                              Forums
                          </i>
                          <span class="badge badge-assertive">0</span>
                      </ion-item>
                      <ion-item nav-clear menu-close ng-click="#">
                          <i class="icon ion-loop" ng-click="#">
                              Connect
                          </i>
                      </ion-item>
                      <ion-item nav-clear menu-close ng-click="#">
                          <i class="icon ion-gear-a" ng-click="#">
                              Settings
                          </i>
                      </ion-item>
                      <ion-item nav-clear menu-close ng-click="#">
                          <i class="icon ion-power" ng-click="#">
                              Log Out
                          </i>
                      </ion-item>
                  </ion-list>
              </ion-content>
          </ion-side-menu>
        </ion-side-menus>
    </ion-pane>
    <script type="text/ng-template" id="home.html">
... (omitted for brevity)
    </script>
    <script type="text/ng-template" id="talk.html">
... (omitted for brevity)
    </script>
    <script type="text/ng-template" id="hdi.html">
... (omitted for brevity)
    </script>
    <script type="text/ng-template" id="you.html">
... (omitted for brevity)
    </script>
    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>
    <script src="js/app.js"></script>

</body>
</html>`

Answer №1

To optimize your website, it is recommended to have a single index.html file where you include all your js and css files instead of duplicating them on every page. Additionally, the way you reference your files, like using id="home.html", suggests that you might be retrieving pages through anchor references, which is not in line with how Ionic framework operates. Utilizing angular controllers for navigation and rendering views is the preferred approach. Regarding font loading, have you ensured compatibility across different browsers such as Chrome and Firefox? For more guidance on this topic, you can check out the following resources:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Modifying an object using setState in React (solidity event filter)

Is it possible to update an object's properties with setState in React? For example: this.state = { audit: { name: "1", age: 1 }, } I can log the event to the console using:- myContract.once('MyEvent', { filter: {myIndexedParam: ...

How do I create a sliding dropdown notification bar?

Can anyone provide some guidance on how to create a sliding dropdown section for my homepage, similar to the one on this website: . (Please note, be cautious of potential malware) I'm interested in replicating the dropdown section that says "call for ...

Utilizing ReactJS to dynamically display various content based on onclick event

Is it possible to dynamically display different content based on button clicks? I want to create a schedule where clicking on specific days like Monday will reveal exercises and timings only for that day. The same goes for Thursday and other days. You ca ...

Regular expressions for capturing login usernames

I recently worked on a web chat project where I utilized socket.io for real-time message sending and receiving. One of the requirements was to capture user logins if they were mentioned within the conversation. Though being a beginner, I attempted to use ...

Django's Implementation of Real-Time WebSocket Notifications

Currently, I am encountering an issue while integrating web socket notifications into my Django project. The problem arises when attempting to pass the user's unread notification count to them. To address this challenge, my initial solution involved ...

"Optimizing Background Images with IE 8 Stretch Cover in Bootstrap

Page Broken I've searched all over Stack Overflow for a solution to resolve this background image issue. I'm using Bootstrap for the boxes and removed any margins. The problem arises when setting the background as cover; in IE8, it doesn't ...

JavaScript can be used to create a fullscreen experience without any toolbars, scrollbars, and the like, without having

Is there a way for me to expand the current window I am using to fullscreen mode and eliminate all toolbars? ...

Adding the AJAX response to an array within the AngularJS framework

I am currently working on a function that involves array objects. $http({ method: 'GET', url: 'select.php' }).then(function success(response) { alert(response); //$scope.posts=response.data; ...

Why ngIf in Angular Ionic doesn't correctly compare arrays from parent when using the 'includes' method?

I have implemented a feature where users can select their interests through a dialog. When a user clicks on a chip, the following method is triggered: handleClick(tag){ let found = false; let index = -1; // tslint:disable-next-line:prefer-for-of for (let ...

The HttpParams are reluctant to be established

Working with Angular 8, I am attempting to assign an HttpParam using the provided code snippet and observing the outcome on the final line. let newParams = new HttpParams(); newParams.set('ordering', 'name'); console.log('getting: ...

Angular JS modal displaying CKEditor is not functioning properly

Utilizing AngularJS, I have implemented a CK editor within a uibmodal window. <div> <textarea ckeditor="editorOptions" id="ckID" ng-model="content"></textarea> </div> To insert text into the CK Editor upon clicking a button name ...

Implement a delay for a specific function and try again if the delay expires

In my TypeScript code, I am utilizing two fetch calls - one to retrieve an access token and the other to make the actual API call. I am looking to implement a 1-second timeout for the second API call. In the event of a timeout, a retry should be attempted ...

Issue encountered when using exports in a React project - Uncaught ReferenceError: exports is not recognized

Recently, as I began my journey with React.js, I encountered a perplexing error. Within my project, there is a file that exports a function in the following format: exports.building = { //... //Something goes here... }; To import this function, I uti ...

JavaScript: Utilize MooTools to extract a string containing a specific class and then pass it through a parent function

I am facing a major issue and struggling to find a solution for it. My problem involves returning values, mostly strings, that I can utilize in various contexts. For instance, I need to verify whether something is 0 or 1 in an if/else statement, or insert ...

Experience the latest HTML5 features directly within a Java desktop GUI, with seamless communication through

This Java desktop GUI utilizes a Java-based web services communication layer along with an HTML library to provide powerful charting and interactivity. I am looking to integrate an HTML5 view within the Java GUI. Can someone assist me in managing JavaScri ...

Exploring ways to utilize Next.js (React) for formatting date and time with either Moment.js or alternate

When deciding on the best method for handling date formats in my next front-end app, should I use Moment.js or JavaScript functions? The data is sourced from the backend as the date type, and I want it to be displayed in a user-friendly format while consid ...

text box with an immobile header

As the browser window size decreases, the layout changes. However, when scrolling down, the search text box moves up and is no longer visible due to its lack of fixation. How can I make the search text box stay fixed as I scroll down? I tried implementing ...

Learn how to update a fixed value by adding the content entered into the Input textfield using Material-UI

I made a field using the Input component from material-ui: <Input placeholder="0.00" value={rate} onChange={event => { this.setState({ `obj.rate`, event.target.value }); }} /> Whenever I input a rate into this field, ...

What is causing nested divs to generate a scrollbar?

I am struggling with a situation involving 3 layers of nested divs: <div class="outer"> <div class="inner"><div class="item"></div></div> </div> In this scenario, the .inner div is set to position absolute and each d ...

Vertical Image Alignment in Bootstrap 3

Looking for some help with a basic HTML structure here. I have a single row divided into two columns, each containing an image of the same size. What I need is to center one image both horizontally and vertically in each column. <div class="containe ...