Android Question webviewextras pass a string to executejavascript

PassionDEV

Active 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 ?
 

PassionDEV

Active Member
Licensed User
thanks for replay the addmssage function is already in the js file
i have tried to pass the message variable like following without success

B4X:
Javascript=$"addmssage('samer', ${message});"$
 

DonManfred

Expert
Licensed 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
 

PassionDEV

Active Member
Licensed User
i am so stupid now because i forget to wrap the variable with ' ' which makes the execution read message like a js function thank you for the correction i think i should drink more coffee
 
Top