Android Question Webview - How to handle "New Tab"

tdocs2

Well-Known Member
Licensed User
Greetings, all.

Thank you in advance for answering my question.

B4X:
    WebViewGCalendar.LoadUrl("http://www.google.com/calendar")
This instruction loads the Google Calendar in a webview. In the Google Calendar, click "More" (next to the Settings icon"), and it shows a dropdown menu with the choice to Print. Click Print and the Webview goes blank.

Open the Google Calendar in Android Chrome. Click Print. A new Tab is opened with the Print Dialog.

How can I do this in a Webview? No events seem to be triggered when I click Print inside the Webview.

Any and all help is welcomed.

Sandy
 

DonManfred

Expert
Licensed User
Webview does not support "Tabs". It does not support new windows too.
I believe you need to setup a javascript-interface and a chrome-client to the webview to get javascript-events and a javascriptconsole. The print-dialog is a new window (popup).
Maybe you can catch the url in the java-script-events / javascriptconsole

Sorry but i cannot provide an example as i dont have one. Just my 2cent
 

tdocs2

Well-Known Member
Licensed User
Thank you, Erel.

The OverrideUrl event is not triggered when I select Print.

The PageFinished is triggered whenever I click on the drop down "More" on the calendar, but when I select Print, I just get a blank screen and the OverrideUrl event is not triggered.

B4X:
Sub WebViewGCalendar_OverrideUrl (Url As String) As Boolean
Log ("Url "&Url)

Return False

End Sub
Sub WebViewGCalendar_PageFinished (Url As String)
Log ("Page Fin Url "&Url)

End Sub
Sandy
 

tdocs2

Well-Known Member
Licensed User
Thank you, Erel.

In Android Chrome, it opens a new tab and the URL shows as "about:blank" on a Print Request.

Sorry, I do not know what an ajax request is.
 
Top