I have a webview object with a url-listener:
local webview = native.newWebView( 0,0, display.contentWidth, display.contentHeight ) webview:request( "page1.html", system.DocumentsDirectory ) webview:addEventListener( "urlRequest", handleUrlEvent )
And inside the webpage (page1.html) there is a link to google and a link to a “corona:something”. I can catch both links within the url-listener:
local function handleUrlEvent( event ) local url = event.url local i,j = string.find(url,"corona:") if( i ~= nil ) then -- do something here ... this seems to work fine else if( url:sub(1,4) == "http" ) then system.openURL( url ) end end return true end
(1) A click on the “corona:something” link triggers a single call to the url-listener while a click on the google link causes 3 calls to the url-listener, and …
(2) The webview itself also gets updated with the google page … shouldn’t it just be handled by the external browser and NOT the webview?
(this is on the Mac simulator … haven’t wanted to test on the device yet)