Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Possible to save/resume the URL in a webview when switching applications?
Started by rishibhat Jan 17 2020 01:01 PM

- - - - -
1 reply to this topic
corona lua webview runtime event
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

rishibhat

[GLOBAL: userInfoPane.html]
rishibhat
  • Observer

  • 3 posts
  • Corona SDK

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?

 



[TOPIC: post.html]
#2

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,473 posts
  • Corona SDK

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




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: corona, lua, webview, runtime event