Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Which code I need to replace with onload function?

I create a phonegap project, when I run it on the browser it's work fine, the onload function work, but on my android device - nothing.

What is the cause of this problem?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
243 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can call function like this onLoad of page

document.addEventListener('deviceready', function(){ alert("hello") });

Dont forget to add cordova.js or phonegap.js to your html files

Updated As per the comments

help.js(another js file)

document.addEventListener('deviceready', LoadPage);

function LoadPage()
{
  window.alert("loadPage");
}

Here is a Simplest JSFiddle Demo, just follow the structure of Html file and run without adding extra files.

All the best


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...