Possible to save/resume the URL in a webview when switching applications?

I am developing an app using Corona SDK in which the primary activity takes place within a webview. Everytime I switch to another app, and then go back to my app, the app essentially restarts, with the webview loading the page that it does when the application starts. I am wondering if there’s any way to save the webview’s current url at the time the app loses focus, and then set the webview to open the last saved url (if it exists) when the user switches back to the app. Is something like this possible? I found some info about runtime events here: https://docs.coronalabs.com/guide/events/detectEvents/index.html but I’m not sure if/how any of these events can be utilized to do what I want. Any ideas?

Hi,

If your WebView reverts to its original state, then you probably don’t need to monitor the events, since the app has essentially reloaded.

You could save/load the previous URL using the Table to JSON technique shown here: https://docs.coronalabs.com/tutorial/data/jsonSaveLoad/index.html#savingloading-tables-to-json

Hopefully that helps get you started in the right direction.

-dev