Call javascript when launch app with cordova app

Hi everyone,
I used cordova and Hype to make app.
I used this code to show an alert when app launch, it worked but I got an another issue.
Click Home button(on device or simulator) and re-open app, this code did not run, no alert show.

  <script type="text/javascript" src="js/index.js"></script>

  <script type="text/javascript" charset="utf-8">

    document.addEventListener("deviceready", onDeviceReady, true);
    function onDeviceReady() {
        alert ('123');

<!-- end copy -->

This code runs only one time ( first time ) when launch app.
How to call alert (‘123’) every time launch app.
Thank you so much.

what happens if you remove the listener when function ‘onDeviceReady’ is called? just a guess …

Sorry, What do you mean?

well, just remove it when it has been called successfully …

or …

1 Like

You mean document.removeEventListener

Nothing change. alert only show one time when app launch first time and nothing show on next time