Skip to content Skip to sidebar Skip to footer

Calls To Phonegap.js Won't Work

When my button is clicked, nothing happens. I've put phonegap-1.4.1.js in the WWW folder. I've included &l

Solution 1:

The file is here:

I've put phonegap-1.4.1.js in the WWW folder.

But you're including it in a different location:

I've included <script src="javascript/phonegap-1.4.1.js" type="text/javascript"></script> in my head section.

It's not loading because it expects to find the file inside a javascript directory, while you've put it in the www folder. Make a dir "javascript" inside the www folder, or remove "javascript" from the src in your script tag.

Solution 2:

You need to call document.addEventListener .. to ensure PhoneGap loaded, So Call init() method on your body onload

<bodyonload="init()">

and put the below in your head tag

<scripttype="text/javascript">var onDeviceReady = function() {
            alert("OnDeviceReady fired.");
        };

        functioninit() {
            document.addEventListener("deviceready", onDeviceReady, true);
        }
    </script>

Solution 3:

you need to make sure that deviceready event is firing. only after it fires would u be able to make phonegap api calls

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

});

Post a Comment for "Calls To Phonegap.js Won't Work"