WebView: "open in new window" possible ?

peacemaker

Expert
Licensed User
Longtime User
Hi, All

Could not find or understand well - is it possible to make a multi-page browser basing on Webview ?
With possibility to have popup menu over the tapped link "Open in a new window" where the window is some new view (actually, another WebView) of the application.
 

peacemaker

Expert
Licensed User
Longtime User
Oh, really margret, thanks!
But what about the long tap popup menu ? Menu is no problem, but it's needed actually as in regular browser only after long tap.

EDIT: actually, i made with Reflection:
Obj1.SetOnLongClickListener("OnLongClick")
Obj1.SetOnCreateContextMenuListener("OnCreateContextMenu")

but there need to know the new link that is got only in OverrideUrl :-(
 
Last edited:
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
No help.... :-(

And i could made myself ! :)

With Reflection:
Obj1.SetOnLongClickListener("OnLongClick")
...
and
B4X:
Sub OnLongClick(viewtag As Object) As Boolean
   Dim a As Reflector, b As String, d As Object
   d = Obj1.RunMethod("getHitTestResult") 
   a.Target = d
   b = a.RunMethod("getExtra")
   If b.Contains("://") Then 
      'making popupmenu to open the link !!!!!!!!!!
   End If
End Sub

Seems, custom browser by WebView is possible :sign0060:
 
Last edited:
Upvote 0

tcgoh

Active Member
Licensed User
Longtime User
Hello,

You should be able to use the URL override of the current webview to catch the link, then display an option dialog to open the link, open in a new window or cancel, etc. If they select new window, then define the new webview.

Hi Margret,


Could you give a example. I'm very new to this overrideUrl and I'm try to allow a new window or open the defualt browser from the webview.

Thanks
TC
 
Upvote 0

Askjerry

Member
Licensed User
Longtime User
I am writing an app that does not use a webview... it is a calculator type program. At the bottom I want a button that says "Visit Us" and when they click it... I want it to open the browser and go to the page.

This is bogus code... just explaining what I want...

B4X:
sub button1_click()
openbrowser("http://google.com")
activity.finish
end sub

So it would send them off to the browser... and close the current activity.

Is that possible?
Thanks,
Jerry
 
Upvote 0
Top