<html>
<head>
<meta name="viewport" id="viewport" content="height=device-height,width=device-width,user-scalable=no"/>
<script type="text/javascript">
function helloWorld() {
alert("Hello World");
}
</script>
</head>
<body onload="helloWorld();">
<h1>Hello World</h1>
</body>
</html>
I have an app built using Blackberry WebWorks similar to above. I need the above helloWorld() function to be fired everytime the user open the app.
The problem is "onload" function only fired when the app first launched, or when the user exit the app by clicking the "hang up button on the mobile", not when clicking on "back button on the mobile".
Any suggestion?
I think that you are interested in launching the function not only every time the app is started, but also when the app is retrieved from the background (this means when your app is not closed, but it is running in the background although you are not interacting with it).
I suggest you use Cordova (former Phonegap) and take a look at the "resume" event. Using the example given there, I think you would need something like this:
You may download the files you need here. I haven't test the code. Try it and let me know if it works for you.