Hi,
im trying to login on https://akgbe.kurswahl-online.de/ and show the loggend in content in a webview. therefore i wrote a js that I want to execute but i can't figure out why it's not working :/
I'm not that familiar with js, but the js console from google chrome and firefox executed the script correctly but my b4a code doesn't ...
my java script (autolog.txt):
and the b4a code:
thanks for any help or suggestions
im trying to login on https://akgbe.kurswahl-online.de/ and show the loggend in content in a webview. therefore i wrote a js that I want to execute but i can't figure out why it's not working :/
I'm not that familiar with js, but the js console from google chrome and firefox executed the script correctly but my b4a code doesn't ...
my java script (autolog.txt):
B4X:
var form = document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("action", "https://akgbe.kurswahl-online.de/login.php");
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", "username");
hiddenField.setAttribute("value", "magnus.gaertner");
form.appendChild(hiddenField);
var hiddenField2 = document.createElement("input");
hiddenField2.setAttribute("type", "hidden");
hiddenField2.setAttribute("name", "passwort");
hiddenField2.setAttribute("value", "mypassword");
form.appendChild(hiddenField2);
document.body.appendChild(form);
form.submit();
and the b4a code:
B4X:
...
WebView1.LoadUrl("https://akgbe.kurswahl-online.de/login.php")
MyWebViewExtras.addJavascriptInterface(WebView1, "B4A")
...
Sub WebView1_PageFinished (Url As String)
timer1.Enabled=True
End Sub
Sub timer1_Tick
MyWebViewExtras.executeJavascript(WebView1,File.GetText(File.DirAssets,"autolog.txt"))
End Sub
thanks for any help or suggestions