Blank screen on launch of phonegap app on old versions of android and iOS

When I first started developing phonegap apps (I had a number in parallel development) I came across and issue where I would have a blank screen upon launch of the app. It would appear as though the javascript just wouldn't fire.

After much investigating, I discovered the cause of this issue.

My app container had the same id as the object I had created

<!DOCTYPE html>

<html lang="en">
    ...
    <body>
        <div id="app"></div>

        <script type="text/javascript" >
            let app = new App;
            app.onDeviceReady(function () {
                app.run();
            });
        </script>
    </body>
</html>

Once I ran the app in xCode and debugged it in Safari, it appeared older versions of iOS and Android (more likely older versions of PhoneGap) didn't like that I had called the instance of my app object "app" and had also called the div that it was rendered into "app".

Try changing the name of the div and see if it works!

Sam L

12th December 2018 23:18

Categories

iOS PhoneGap Android