Android Question Webview / WebviewExtras, Javascript and SDK21

TheJinJ

Active Member
Licensed User
Hi

Happy New Year!

I've been working on an app which utilises a Webview and Webviewextras. It loads a HTML form and auto fills the elements using Javascript. This has been working fine when building for SDK upto 14 but I was trying to build for L with SDK21 and now it doesn't work in the same way.

Filling in check boxes or radio buttons works ok eg:

Using webviewextra.executejavascript command.....

<input id="Field13" name="Field13" type="checkbox" value="Tick me">
document.getElementById('Field13').checked=true;

....but trying to fill text fields results in the page clearing and just showing the field value eg:
<input id="Field1" name="Field1" type="text">
document.forms.form723.Field1.value='Whatever';
or
document.getElementById('Field1').value='Whatever';

Has something changed since SDK14 that would produce this result?

Hope that wasn't too confusing!?!

Cheers
Neil
 

warwound

Expert
Licensed User
Can you try the attached WebViewExtras update?
It uses the new evaluateJavascript method on KitKat+, on older versions it uses the loadUrl method to execute javascript using the javascript: psuedo protocol.
 

aignatd

Member
Licensed User
I've now updated WebViewExtras2 to make it compatible with android API 19+.

WebViewExtras v 1.41 can be downloaded from the WebViewExtras thread: http://www.b4x.com/android/forum/threads/webviewextras.12453/

And WebViewExtras2 can be downloaded from: http://b4a.martinpearman.co.uk/webviewextras/WebViewExtras2-v2.10.zip.
I use basic4android Ver. 4.
I running webview demo.
Why the javascript not showing toast message when running on release mode ?
but when on debug mode the javascript running well.
I use WebViewExtras2


Thank you
 

warwound

Expert
Licensed User
I use basic4android Ver. 4.
I running webview demo.
Why the javascript not showing toast message when running on release mode ?
but when on debug mode the javascript running well.
I use WebViewExtras2


Thank you
Are you sure that you replaced the old version of WebViewExtras2 with the updated version?
Does WebViewExtras show version 2.10 in the ide list (right hand side of ide)?
 

aignatd

Member
Licensed User
Are you sure that you replaced the old version of WebViewExtras2 with the updated version?
Does WebViewExtras show version 2.10 in the ide list (right hand side of ide)?
I am pretty sure that use webviewextra2 version 2.10.
can be drawn following....

upload_2015-1-17_18-37-33.png
 

aignatd

Member
Licensed User
Export your project to a zip file and upload it and i'll take a look.
If you project is too large or contains stuff you'd not want to upload then create a new simple project that shows the problem.
Sorry for my late reply.
This my sample project
 

Attachments

warwound

Expert
Licensed User
Hi there.

I tried your project on my Moto G running KitKat and it works with no problems.
The javascript gets executed in both Release and Debug(legacy) modes.
In Debug (rapid) mode the WebViews fail to find the file web_view_extras_demo.htm so nothing works.
That's not a bug in the code, just a side effect of using rapid debug mode, read more here:
http://www.b4x.com/android/forum/pages/results/?query=rapid+debug+file+not+found&page=1&prefix=0.

I've updated your project to use a WebChromeClient and that all works with no problems too.

So i'm not sure what to suggest.
What device and what version of android are you using to run your project?
 

Attachments

Erwin Andersen

Member
Licensed User
Hi there.

I tried your project on my Moto G running KitKat and it works with no problems.
The javascript gets executed in both Release and Debug(legacy) modes.
In Debug (rapid) mode the WebViews fail to find the file web_view_extras_demo.htm so nothing works.
That's not a bug in the code, just a side effect of using rapid debug mode, read more here:
http://www.b4x.com/android/forum/pages/results/?query=rapid debug file not found&page=1&prefix=0.

I've updated your project to use a WebChromeClient and that all works with no problems too.

So i'm not sure what to suggest.
What device and what version of android are you using to run your project?
Hi,

I use basic4android Ver. 5
I running webview demo.
Why the javascript not showing toast message when running on release (obfuscated) mode ?
but when on debug mode the javascript running well.
I use WebViewExtras2
 
Top