Android Question webviewextras pass a string to executejavascript

Addo

Well-Known Member
Licensed User
i have this sub that executejavascript inside webview

B4X:
Dim Javascript As String
Dim message As String

message = EditText1.text
    
Javascript=$"addmssage('samer', 'message');"$

'Log(Javascript)
WebViewExtras1.executeJavascript(WebView1, Javascript)


but it seems i cannot inject the edittext1.text to javascript string how possible i can pass a string inside the javascript variable in this case ?
 

DonManfred

Expert
Licensed User
Longtime User
Dim message As String

message = EditText1.text
You defined a String but you don´t used it. Why?
You are setting the commands fix in your code
Javascript=$"addmssage('samer', 'message');"$
Edit to add: note that there must be a javascript function named addmssage already in your webpage....
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
try
B4X:
Javascript=$"addmssage('samer', '${message}');"$

For any other issue you need to provide more infos. Does not work is the wrong info.. What exactly is the error you get?

Make sure to enable a logging for any javascripterrors... Don´t know exactly how but i remember that i read something like that in the past.
Try the forumsearch
 
Upvote 0
Top