B4A Library WebViewExtras

Discussion in 'Additional libraries, classes and official updates' started by warwound, Nov 7, 2011.

  1. sfgwl

    sfgwl Member Licensed User

    very good
  2. eps

    eps Well-Known Member Licensed User

    I've been using the excellent WebViewExtras2 library to great effect, thanks for providing this.

    I've come across an issue - although to be honest it might not be solveable or be worth spending a lot of time on..

    I have been using a current Android device (HTC 10) to work with babylonjs which uses webgl to display 3D graphics in HTML5..

    This works as expected.

    My current device has developed a problem - it's going to HTC to be fixed. I've resurrected an old device of mine and wanted to continue developing - or rather confirming that the HTML5 'app' works as expected on a smartphone.. e.g. an HTC Evo 3D (running... Android 4.0.3). Now this does seem to have some webgl capabilities, which I've confirmed using html5test.com.. but if I go to that website using a ChromeClient via WebViewExtras2 it doesn't have webgl enabled or permitted - which is really frustrating! I was just wondering if there was any way of attempting to expand the webgl capabilities of WebViewExtras2 or if anyone had an inkling as to why it works on the HTC 10 but not on the Evo 3D. Of course I could just be pushing the realms too far - but when I used a CustomChromeTab this had webgl enabled on the Evo 3D - so something in the library seems to be setting webgl to disabled... admittedly 4.0.3 is pushing it. But then in the CustomChromeTab I can't load a local html file... which is what I've been doing in WebViewExtras2.

    Anyone able to shed any light on this please? or shall I just wait until the newer phone is returned?
  3. An Schi

    An Schi Well-Known Member Licensed User

    I don't know if that helps or is connected to your problem...
    In one of the android 4.x versions (4.1 or 4.4?) the webview was improoved and features were added. Take a look at the android documentation for more detailed infos.
  4. smallqiang

    smallqiang New Member Licensed User

    Hello warwound, thank you very much for writing webviewextras2, the best b4a WebView extension. In using of this lib, I found below the SDK 23 , onReceivedError is contain a bug, there is no way to obtain 404 error. In order to solve this problem, Google added a onReceivedHttpError event to solve the problem in SDK23. Can you update the trouble of libraries, making it more perfect? Thank you for sharing
    peacemaker likes this.
  5. An Schi

    An Schi Well-Known Member Licensed User

    I wanted to use the _PageStarted Sub from the DefaultWebViewClient. But the app allways crashed, when i clicked on a link with the error:
    java.lang.Exception: Sub def_pagestarted signature does not match expected signature.

    Erel suggested to replace

    Sub Def_PageStarted(Url As String, FavIcon As Bitmap)
    Log("PageStarted URL = " & Url)
    End Sub

    Sub Def_PageStarted(Url As String, FavIconO As Object)
    Dim FacIcon As Bitmap = FavIconO
    End Sub
    Now the app doesn't crash anymore.

    Here you can see the whole thread: https://b4x.com/android/forum/threads/solved-pagestarted-signature-error.83126/#post-526484
    Erel likes this.
  6. Shay

    Shay Well-Known Member Licensed User

    I am trying to autoplay this radio station
    on windows it will autoplay, but in webview it is not
    I am trying:

    MyWebViewExtras.JavaScriptEnabled = 
    ... after 
    page is loaded
    it is not helping
    (using WebViewExtra2 2.2)

    also tried without luck:
    Last edited: Sep 2, 2017
  7. DonManfred

    DonManfred Expert Licensed User

    Both javascript commands are not doing anything...
    What doyou expect to happen?
  8. Shay

    Shay Well-Known Member Licensed User

    On the web page, the button to start the live streaming is only sending this void command
    this is the button element:

    Attached Files:

  9. DonManfred

    DonManfred Expert Licensed User

    Check the javascript used in the page.
    There must be something which is using btnToggle and/or iconcontainer.
  10. Leni Berry

    Leni Berry Active Member Licensed User

    How to Get the source code of a webpage with WebView and WebViewExtras2 not WebViewExtras?

    Please Help
  11. DonManfred

    DonManfred Expert Licensed User

    1. You should always creeate a new thread for any question you have
    2. Search the forum. It is handled a few times...
  12. Leni Berry

    Leni Berry Active Member Licensed User

    Tq Manfred.
    My question described here.
  13. JohnC

    JohnC Well-Known Member Licensed User

    OK, I found a bug, don't know if its a WVE bug or it's another example of why you can't use MsgBox2 in an event sub.

    (This bug seems like it might be related to another bug I found: https://www.b4x.com/android/forum/threads/weird-webview-and-msgbox2-conflict.83602/#post-529656)


    If I use this code on the first page of this thread:

    Sub MyEventName_GeolocationPermissionsRequest As Int
    Dim Response As Int
    Msgbox2("Allow the webpage to use device geolocation features?""Permission required:""Allow""""Disallow"Null)
    If Response=DialogResponse.POSITIVE Then
    ToastMessageShow("Permission granted"True)
    ToastMessageShow("Permission denied"True)
    End If
    End Sub
    After I click "Allow", the webpage seems like it can NOT run javascript reliably on it anymore.

    However, if I simply have:
    In the above sub, then the webpage acts correctly after I click Allow.
  14. John Woodsmall

    John Woodsmall Active Member Licensed User

    i have simple html page (that works in desktop crome). It saves the input varibles
    and then later wants to retrieve them.

    does not seem to work under /files ???

    var equ = document.getElementById('Equip_Mod').value ;
    var wag = document.getElementById('Cust_name') ;
    wag.value= window.localStorage.getItem("Cust_name");
  15. magarcan

    magarcan Active Member Licensed User


    I'm working from your example here.
    The fact is WebView1_PageFinished Event is triggered before the site has been fully loaded. I've set un a Delay before executing the Javascript and it works, but don't think this is the best way.

    Any idea?

  16. warwound

    warwound Expert Licensed User

    PageFinished means that all resources on the webpage have been loaded from the server, it does not mean that those resources have been fully rendered within the WebView.

    Do you have control over the webpage?
    If so then you can add a javascript event listener that will execute when the webpage has been fully rendered and that javascript can call a b4a sub via a JavascriptInterface.
    Look here for more info: https://www.w3schools.com/jsref/event_onload.asp

    If you have no control over the webpage then the only thing i can think of is to inject some javascript into the webpage and that injected javascript creates an onload event listener and calls a b4a sub via a JavascriptInterface.
  17. Srikanth.pendru

    Srikanth.pendru New Member Licensed User

    hi all

    The following URL open without any issue in browser but not rendering with webview


    login credentials:

    demo / demo

    tried with webviewextras but failed

    need some support, Thanks in advance.
  18. Derek Johnson

    Derek Johnson Active Member Licensed User

    You should probably post this as a separate question, however I changed the URL in the WebView Extras demo code and got this on my Nexus 5X. What is the issue? (It was slow to load however).

    Attached Files:

    • Pos.png
      File size:
      19.6 KB
  19. Srikanth.pendru

    Srikanth.pendru New Member Licensed User

    Hi Johnson,

    please login as demo / demo

    and try to login in regular browser
  20. Derek Johnson

    Derek Johnson Active Member Licensed User


    I did spot this error after I logged in and it did take 10-20 seconds to finish loading after the page finished event in WebView.

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice