I have a webView in my app, and I want to know the current URL address that is shown in the webView.
The user might have clicked some links in the webpage or the Forward/Backward buttons (implemented in my webView), so the current URL address is changed by the user’s operations.
I originally thought I could get this URL address by the listener, such as
local function webListener( event ) if (event.url ~= nil and (event.type == "link" or event.type == "loaded") then updateCurrLinkAddress(event.url) end end
This way works for most cases but if the user clicks Forward/Backward buttons, this method does not work.
I can’t just use any event.url as the link address because the webpage might have other webpage embedded, such as Facebook plugins or some ad pages. The listener reports all kind of links.
Is it possible for Corona SDK to set the current URL address into a property? and I can just read this property. Is it there already?
This is important when you want to share the link inside the webView. This feature is required by so many users of my app. They browse the net via my webView and suddenly they like the page and they want to share it. Although they can share via webpage share links, but you know the users, they don’t care, they just think your app sucks because you don’t provide such a feature. And besides, share things via app is more intuitive & straightfoward.