Any way the app can retrieve anything from the webView?

I am going to use the webView to list some stores in a list and let the user click on one to select. Is there any way to retrieve in the app what was selected? Can I view the URL anytime from the web to see if there is a parameter in the URL and use that? I know I can pass the URL to connect to but how about retrieving the current URL? This is with the webView that is inside the app and not an external one.

Thanks,

Warren

hey Warren,

AFAIK, you can’t VIEW the URL which is already loaded, but instead you add an event listener to know when the webview is loading a new URL.

anytime you load a URL in a webview, the webview handler will be called. this includes clicking on links in the loaded HTML, even if the links are relative and only add params.

here’s a page i am using in an app i’m currently building:

\<html\> \<body\> \<h1 class='title'\>Registration Page\</h1\> \<br/\>\<br/\>\<br/\> \<a href='?reg\_status=completed' \>Completed registration\</a\> \<br/\>\<br/\>\<br/\> \<a href='?reg\_status=canceled' \>Canceled registration\</a\> \</body\> \</html\>

in this case, event.url will be the same URL i loaded since the URLs in <a> are relative. but the params will be added on the URL, so then i can split it up into its various parts using require( ‘socket.url’ ).

i used this technique in my public module ‘dmc_facebook’. if useful, you can check it out to see an example, plus there are some other beneficial support functions, like parse_query().
https://github.com/dmccuskey/DMC-Corona-Library

cheers,
dmc

hey Warren,

AFAIK, you can’t VIEW the URL which is already loaded, but instead you add an event listener to know when the webview is loading a new URL.

anytime you load a URL in a webview, the webview handler will be called. this includes clicking on links in the loaded HTML, even if the links are relative and only add params.

here’s a page i am using in an app i’m currently building:

\<html\> \<body\> \<h1 class='title'\>Registration Page\</h1\> \<br/\>\<br/\>\<br/\> \<a href='?reg\_status=completed' \>Completed registration\</a\> \<br/\>\<br/\>\<br/\> \<a href='?reg\_status=canceled' \>Canceled registration\</a\> \</body\> \</html\>

in this case, event.url will be the same URL i loaded since the URLs in <a> are relative. but the params will be added on the URL, so then i can split it up into its various parts using require( ‘socket.url’ ).

i used this technique in my public module ‘dmc_facebook’. if useful, you can check it out to see an example, plus there are some other beneficial support functions, like parse_query().
https://github.com/dmccuskey/DMC-Corona-Library

cheers,
dmc