B4A Library WebViewExtras

ArminKH

Well-Known Member
I cant remove webchromclient because i want extract the source of site and webchromclient is necessary for this
I am not familar with java syntax
 

warwound

Expert
Licensed User
Longtime User
Which version of WebViewExtras are you using?
Is it the version (one) available to download in post #1 of this thread?
Or are you using WebViewExtras2 that's only available to download from my server at b4a.martinpearman.co.uk?
 

ArminKH

Well-Known Member
I use version 1.4
Can u create an option in addwebchromeclient as boolean for enable or disable javascript alerts?
 

ArminKH

Well-Known Member
Are you sure about that?
I'd have guessed that you only need a JavascriptInterface?
Yes
i put this in global
B4X:
Dim Tojava,SCJAVA As WebViewExtras
and put this in activity_create
B4X:
 SCJAVA.addJavascriptInterface(WebView1, "B4A")
          SCJAVA.addWebChromeClient(WebView1, "")
then login to my site by this

B4X:
Tojava.executeJavascript(WebView1,"document.getElementById('txtUserName').value='"&txtusername.Text&"';")
          Tojava.executeJavascript(WebView1,"document.getElementById('txtPassword').value='"&txtpassword.Text&"';")
          Tojava.executeJavascript(WebView1,"document.getElementById('TXT_CAPT').value='"&captchacode.Text&"';")
          Tojava.executeJavascript(WebView1,"document.getElementById('LoginButton').click();")
then extract source of site by this

B4X:
Sub Process_HTML(Html As String)
                 source=Html
          End Sub

BUT When user and pass is wrong webview show an alert and i want to disable that
 
Last edited:

warwound

Expert
Licensed User
Longtime User
Try the attached modified version of WebViewExtras 1.4.
You need WebViewExtras as well as this modified WebViewExtrasArminkh library checked in the b4a IDE library list.
Now find and replace all occurences of WebViewExtras with WebViewExtrasArminkh.
For example change:
B4X:
Dim WebView1 As WebView
to:
B4X:
Dim WebView1 As WebViewArminkh

The WebChromeClient no longer displays javascript dialogs (untested!).

Martin.
 

Attachments

  • WebViewExtrasArminkh.zip
    7.7 KB · Views: 422

ArminKH

Well-Known Member
i will test this tonight
tnx for your quick response martin
 

oceanwanderlust

Member
Licensed User
Longtime User
Earlier in this thread there is some discussion of disabling the clipboard by handling the long click, but I am unsure of the current status. Using AJWebkit, I can receive the LongPress in my DefaultWebViewClient, but even when I return True, the clipboard still appears. How do I intercept this event so that the clipboard does not appear?
 

warwound

Expert
Licensed User
Longtime User
WebViewExtras updated to version 2.41

This update makes the executeJavascript method compatible with android API level 19+.
More info can be found here: https://www.b4x.com/android/forum/threads/webview-webviewextras-javascript-and-sdk21.48968/.
WebViewExtras v 2.41 is attached to the first post i this thread.

I have also applied the same update to the (never got officially released) WebViewExtras2 library.
WebViewExtras2 can be downloaded from: http://b4a.martinpearman.co.uk/webviewextras/WebViewExtras2-v2.10.zip.
 

ArminKH

Well-Known Member
Tnx 4 new update
In this update you combine modified web view extra arminkh in above post(you create this modified version for me before)with default version? And if not can you please create new modified version of new update for me?
 

warwound

Expert
Licensed User
Longtime User
Tnx 4 new update
In this update you combine modified web view extra arminkh in above post(you create this modified version for me before)with default version? And if not can you please create new modified version of new update for me?

I've attached the modified version for you.
 

ArminKH

Well-Known Member
Can i use default version and modified version together?(in an activity i want show modal dialog and in other activity i dont want show that)
I think if i use this two lib together maybe app will be crashed
Is this wrong?
Tnx again for your quick response and excuse me for my english
 

warwound

Expert
Licensed User
Longtime User

I've recompiled your update so that it's java packagename is different to the normal version of WebViewExtras.
You should now be able to use the normal version and your version in the same application.
 

Attachments

  • WebViewExtrasArminkh-v2.41.zip
    8.1 KB · Views: 399

BobsYourUncle

Member
Licensed User
Longtime User
Hi Martin,
A big thank you for your WebViewExtras library! Saved my bacon today!
Works a treat on KitKat as well...
Cheers,
Bob.
 

Siam

Active Member
Licensed User
Longtime User
Hello,

i hope that i be right here?

since Android 4.4.x it was not possible to upload files with webview because google has removed this function. Now Android 5 is Out and it should work with it.
But here is my Problem i must say to the webview that it is allowed to open a File Selector here is what i have found about it:


My question is now. is it possible to add this function to webviewextras ?

lg

Andy
 

bluedude

Well-Known Member
Licensed User
Longtime User
Hi, is this working on API 21?

I'm trying to use it after a long time and it does not seem so work anymore on Android 4.4.4.

Which one is the latest version, 1.41?
 

warwound

Expert
Licensed User
Longtime User
Version 1.41 is the latest version of the original WebViewExtras.
WebViewExtras2 is available for download from my server (let me know if you want a link).

Both libraries call the same android API methods but WebViewExtras2 is more complete - wrapping more of the API.

Kitkat broke a number of WebView related functions.
For example file uploads do not work in Kitkat - don't work in java and don't work in b4a.
Lollipop has restored some functions but it's unclear exactly what works and what doesn't - unless you have many hours to research the subject.

What exactly are you trying to do?
 

bluedude

Well-Known Member
Licensed User
Longtime User
Thanks warwound, got it working with Bootstrap, jQuery and your library. Pretty cool and responsive and hybrid.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…