Hi Martin!
Before I post I tried your example, but I don't now how I have to use it.
Assumed I click for example on 3 web-links on the webview and every time it shows a new page in webview and I want to save every new page. What is to modify at your code example? Many thanks.
Walter
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim myInterface As JSInterface
Dim WebView1 As WebView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("layoutMain")
WebView1.Width=100%x
WebView1.Height=100%y
' add the B4A javascript interface to the WebView
myInterface.addJSInterface(WebView1, "B4A")
' now load a web page
WebView1.LoadUrl("http://www.b4x.com/android/help/jsinterface.html")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub WebView1_PageFinished (Url As String)
' Now that the web page has loaded we can get the page content as a String
Dim jsStatement As String
jsStatement="B4A.CallSub('processHTML', document.documentElement.outerHTML)"
Log("PageFinished: "&jsStatement)
myInterface.execJS(WebView1, jsStatement)
End Sub
Sub processHTML(html As String)
' This is the Sub that we'll get the web page to send it's HTML content to
' Log may truncate a large page so you'll not see all of the HTML in the log but the 'html' String should still contain all of the web page HTML
Log("processHTML: "&html)
End Sub