Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

webview Listener html body
Started by kakula Oct 31 2018 01:58 AM

1 reply to this topic
webview listener html body
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

kakula

[GLOBAL: userInfoPane.html]
kakula
  • Enthusiast

  • 75 posts
  • Corona SDK

Hi,

 

for webviews

 

is there a way to read the html content of a webview through the listener (for example   print(event.html) or print(event.body))

 

local function webListener( event )
    if event.url then
--     print(event.html) or print(event.body)
        print( "You are visiting: " .. event.url )
    end
  
    if event.type then
        print( "The event.type is " .. event.type ) -- print the type of request
    end
  
    if event.errorCode then
        native.showAlert( "Error!", event.errorMessage, { "OK" } )
    end
end
webView = native.newWebView( display.contentCenterX, display.contentCenterY-100, display.contentWidth, display.contentHeight-200)
    webView:request( "www.coronalabs.com" )
webView:addEventListener( "urlRequest", webListener )

 



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,860 posts
  • Corona Staff

Not that I'm aware of.  Corona can detect when links are interacted with and you can get the URL that was interacted with. If that URL has HTTP style GET key-value pair parameters, you could parse that data out and get information that way.

 

Rob




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: webview, listener, html body