Reload an app from javascript


What is the better way to “reload” an app (reset, as if you first start) from the code of my app ?

I have tried “location.reload();”, it reload the app BUT : absolutely no network access anymore…

I don’t understand why (on Android 7.0)


Just out of curiosity, what is the purpose of wanting to ‘reload’ the app? I’m fairly certain I have experienced what you are talking about, not specifically the no network issue but after say a ‘Refresh’ or ‘Hard Reload’ the app appears to loose functionality.

Have you tried maybe httpD with a set port and then the location.reload


Safest way, surprisingly, is like this:

forge.reload.applyAndRestartApp(function () {});

Also see:

Edit: The API is “polite” by design so it will still restart even if there’s nothing to apply.

There’s been very little call for this so we never bothered to break the restart portion out into its own API :slight_smile:


So are you saying just to fo-trigger a reload? Will it not thrown an error if there is not downloaded reload package?


A very bad reason :slight_smile: A Single Page Application in which I don’t understand a bug, that resolve only after a F5 on browser and I have a demo in 1 day. So I will look investigate after the demo.

But I was surprised to loose all the network access. Quite strange


Thank’s a lot Antoine ! I didn’t think to look there.


Yah, that does not seem to really make sense… so like images and the like are no longer accessible or your xhr calls wont work?


I found what I think is a bug because your solution don’t work.

I can say with certitude than on Android (6 or 7, didn’t try 8),

after calling :



forge.reload.applyAndRestartApp(function () {});

then :

return undefined


Are you calling from inside the connectionStateChange listener?


    if ( {
        // device is connected to the Internet
    } else {
        // handle case where device does not have an Internet connection

The results are undefined if you call it anywhere else.