semar Active Member Licensed User Longtime User Feb 16, 2021 #1 Dear all, the CallSub function works by WebViewExtra, but I can't get it working with WebViewExtra2. Is this functionality in someway broken ? Or am I missing something obvious here ? In the attachment is a test project. Clicking on the button should change the text in the label. The function in the jstest.js is successfully called - you can see that the JavaScript "alert" is fired. But the function does not call the counterpart function "fromJavascript" in the B4A program. It would be nice if someone could share a bit of light on how to get it working with WebViewExtra2. Best regards Sergio Attachments javascriptTest.zip javascriptTest.zip 10.3 KB · Views: 538 Last edited: Feb 16, 2021
Dear all, the CallSub function works by WebViewExtra, but I can't get it working with WebViewExtra2. Is this functionality in someway broken ? Or am I missing something obvious here ? In the attachment is a test project. Clicking on the button should change the text in the label. The function in the jstest.js is successfully called - you can see that the JavaScript "alert" is fired. But the function does not call the counterpart function "fromJavascript" in the B4A program. It would be nice if someone could share a bit of light on how to get it working with WebViewExtra2. Best regards Sergio
josejad Expert Licensed User Longtime User Feb 16, 2021 #2 Hi: Add this code to your project, and it works: Code: Copy Dim JavascriptInterface1 As DefaultJavascriptInterface 'Add this line JavascriptInterface1.Initialize 'Add this line wbx.AddJavascriptInterface(JavascriptInterface1, "B4A") 'Change in this line wbx for JavascriptInterface1 Upvote 0
Hi: Add this code to your project, and it works: Code: Copy Dim JavascriptInterface1 As DefaultJavascriptInterface 'Add this line JavascriptInterface1.Initialize 'Add this line wbx.AddJavascriptInterface(JavascriptInterface1, "B4A") 'Change in this line wbx for JavascriptInterface1
semar Active Member Licensed User Longtime User Feb 16, 2021 #3 José J. Aguilar said: Hi: Add this code to your project, and it works: Code: Copy Dim JavascriptInterface1 As DefaultJavascriptInterface 'Add this line JavascriptInterface1.Initialize 'Add this line wbx.AddJavascriptInterface(JavascriptInterface1, "B4A") 'Change in this line wbx for JavascriptInterface1 Click to expand... And, indeed, it works ! Many thanks José for your kind support ! ? Upvote 0
José J. Aguilar said: Hi: Add this code to your project, and it works: Code: Copy Dim JavascriptInterface1 As DefaultJavascriptInterface 'Add this line JavascriptInterface1.Initialize 'Add this line wbx.AddJavascriptInterface(JavascriptInterface1, "B4A") 'Change in this line wbx for JavascriptInterface1 Click to expand... And, indeed, it works ! Many thanks José for your kind support ! ?