简体   繁体   中英

Corona SDK: 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?

edit: the webview is created in Lua using the standard native.newWebview() described in https://docs.coronalabs.com/api/library/native/newWebView.html

Hello you can use system event "applicationStart" and "applicationExit" to save url and load again that url when your application start again.

see below doc.

https://docs.coronalabs.com/api/event/system/type.html

and also you can find soluton for corona on below link

https://forums.coronalabs.com/forum/532-newbie-questions/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM