Android Question WebKitLibrarySet create child windows

juventino883

Member
Licensed User
Longtime User
Hi, I'm updating an APP that was using UltimateWebView library to WebkitLibrarySet but I'm having some troubles creting child windows, I'm trying this whay (that was working with UWV) the function is triggered but it seems that the child window is never created

[CODE lang="b4x" title="WebKitWebView1_CreateChildWindow"]Private Sub WKWebView1_CreateChildWindow (IsDialog As Boolean, IsUserGesture As Boolean) As WebkitWebView
Log("Added New Child Window")
'Return Null if you do not want to create child window. Page will not be loaded!

NewUltimateView.Initialize(Me,"NewUltimateView")
NewUltimateView.EnableSlowWholeDocumentDraw
NewUltimateView.Settings.ImportSettingsFrom(WKWebView1.WebView) 'Import settings from main UltimateWebView without referencing.

NewUltimateView.CookieManager.AcceptCookies=True
NewUltimateView.CookieManager.AcceptFileSchemeCookies=True
NewUltimateView.CookieManager.AcceptThirdPartyCookies=True
NewUltimateView.CookieManager.Flush
Log(NewUltimateView.OriginalUrl)
Return NewUltimateView 'Return created UltimateWebView like child window. Library will do the rest. You can initialize all needed events for this child.
End Sub[/CODE]

I'm checking child windows to see if it is created but in .WebChromeClient.WebViewsChildrenViews the list is empty, Is there any other step to create child windows with WebKitLibrarySet?
 
Solution
Hi I have found the issue, it was a problem with my code, the return value should be a webview instead of a webkitwebview ??‍♂️

in UltimateWebView you return an UltimateWebView object, but in WebKitLibrarySet you should pass a WebView

B4X:
Private Sub WKWebView1_CreateChildWindow (IsDialog As Boolean, IsUserGesture As Boolean) As WebView

and the return is made this way

B4X:
Return NewUltimateView.WebView
Hi I have found the issue, it was a problem with my code, the return value should be a webview instead of a webkitwebview ??‍♂️

in UltimateWebView you return an UltimateWebView object, but in WebKitLibrarySet you should pass a WebView

B4X:
Private Sub WKWebView1_CreateChildWindow (IsDialog As Boolean, IsUserGesture As Boolean) As WebView

and the return is made this way

B4X:
Return NewUltimateView.WebView
 
Last edited:
Upvote 0
Solution
Hi I have found the issue, it was a problem with my code, the return value should be a webview instead of a webkitwebview ??‍♂️

in UltimateWebView you return an UltimateWebView object, but in WebKitLibrarySet you should pass a WebView

B4X:
Private Sub WKWebView1_CreateChildWindow (IsDialog As Boolean, IsUserGesture As Boolean) As WebView

and the return is made this way

B4X:
Return NewUltimateView.WebView
Yes, the return result is a WebView because the WebkitLibrarySet is compatible with the standard B4A WebView. All other classes from WebKitLibrarySet have seen the same changes.
 
Upvote 0
Back
Top