Refresh page from browser


Andrea
Hello David and @ll. I had started a project with the older generation of App Builder some time ago, I have to complete it. When I start the app starting http connections, the answers lead me to different views, as well as store variables. When I test the application from the browser everything seems ok, but when I refresh the page from the button or F5, my app loses its functioning. I tried putting the event ready of the view for example the re-execution of a connection (http), but as mentioned at the refresh nothing works anymore, what solution for this problem? thank you so much friends!

DecSoft

Hello Paolo,

I am not sure if I can help in an exact way with the information that I have, but, I will try it with some information from my own:

1º Even when we can try to catch the F5 key, maybe also the CTRL+F5 keys, in order to avoid the browser to be refreshing, probably this is not a very good idea, I mean, if the user want to press the F5 key or refresh the browser by other way (the menu, for example) he must can to do it. So thinking to avoid the browser to be refreshing can't be a solution in my opinion.

2º The Ready event of the old DecSoft App Builder, is not related with a specific view, but with the whole app. This mean that if we enter the app from the "View2", the same "Ready" event is executed than if we enter the app from the "View1".

3º Sometimes we use the first / default app's view in order to initialize some variables for the entire app, or to made some HTTP calls which get us information to be used in the entire app (other views). This is important, because, certainly, if we go to the View1 to the View2, and, once we reach the View2, the browser is refreshing by the user, what is loaded is the View2, and not the View1, as we can expect.

4º The above 3 point can be your case, Paolo, and, there is a solution to force to load the View1 firstly of all other app's views. So, even when the user refresh the browser at the View2, we can force to goto the View1 and start the app from that View1 view. The solution is more or less easy, for example, we can use the View1 Show event to place a code like the below:

... then, in every other app's view Show events, for example, in the View2 Show event, we can place a code like the below:

... now suppose your app start and then you or the user go to the View2. Everything works as expected, because you go to the View2 from once the View1 has been loaded. Suppose now that the user refresh the browser at this point, that is, when he is in the View2. In this case, the above View2 Show event is executed, and, since the "MainViewIsLoaded" variable is not defined (because it's defined in the View1 Show event), we just redirect the user to the View1, and therefore the app started as expected, from the View1.

5º On the other hand, we must know that the app variables are not saved if the user refresh the browser. If we really want to store something between app executions, we must use the browser's local storage. The old (previous) generation of DecSoft App Builder provides you with actions like "SetOption" and "GetOption", which deal with the browser's local storage. If you save something in the local storage, when the app starts again (for example, because the user refresh the browser), that stuff is available to be used. You must take this in consideration if you need to store something that remain between app executions: the app's variables are lossed when the app is restarted, but the local storage is there to save information which is not deleted between app's executions.

6º Another possible way to store information can be the app's server. If we save something in the app's server, for example, in a database, that information remain intact even if the user refresh the browser. So we can consider this like a "server storage", something similar than the local storage, but, with the information saved in the server side.

Said the above, I think your specific problem is related with the app's views. I suppose that you made some initialization in the main / default view's Show event, in other words, you expect that the app starts in the default / main view, and, certainly, as I refer in the point number 3 above, if the user is in the View2, and, then refresh the browser, then the app start from the View2, and not from the View1 (the default / main view). If this is the case, what you must to do is what I explain in the points 3 and 4, that is, force the app to start in the View1 (the default / main view), so the app's initialization is made as expected.

I hope this information can help you in some way or give you the right ideas, but, please, go ahead and post here if you have any further questions, Paolo.



Andrea
you were just perfect! I had thought of this solution, and your confirmation makes me happy. To store the status of some variables that are set only once I'm already relying on a json file that resides in the webserver, and everything seems to go perfectly. Thanks always, App Builder it's a real power and satisfaction of its own and wonderful for the support too! Thanks thanks thanks

DecSoft

Hello Paolo,

you were just perfect! I had thought of this solution, and your confirmation makes me happy. To store the status of some variables that are set only once I'm already relying on a json file that resides in the webserver, and everything seems to go perfectly. Thanks always, App Builder it's a real power and satisfaction of its own and wonderful for the support too! Thanks thanks thanks

You're welcome! Glad to know that I can help you in some way, Paolo. Thank you for your kindly words!


Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.

Este sitio utiliza "cookies" útiles para almacenar sus preferencias.

Bien. Ocultar esta nota. Obtener más información.